notbob
  •  notbob
  • 50.6% (Neutral)
  • YAF Forumling Topic Starter
2008-07-30T10:08:48Z
hi all,

I'm integrating YAF into our software and it's been an interesting ride so far, as we've run into several issues over versions with the AjaxToolkit but I got those solved.

Now I'm onto what seems like an obvious and easy thing to do but has turned out to be a major headache.

I want to place the ForumActiveDiscussion control on a page not inside of YAF, it's actually in the folder right above forums.

<YAF:ForumActiveDiscussion ID="ActiveDiscussions" runat="server" OnNeedDataBind="OnNeedDataBind" />

Problem is when you go to run it the PageContext is always null and the localization routines toss a ton of errors up.

Can someone explain to me how to utilize this control outside of YAF's main forum control?

Our end goal is to have the active discussions show up on a users homepage elsewhere in the system, if I could just get some basic tips to get past this pagecontext problem I should be good to go.

Also is there a way to join the contributors group for this project? I'm a full-time .net developer and would love to help out.

Thanks
Bob
Sponsor
muneeb_baig
2008-08-18T10:46:06Z
Quote:

Our end goal is to have the active discussions show up on a users homepage elsewhere in the system, if I could just get some basic tips to get past this pagecontext problem I should be good to go.



I am not an expert but can help you achieving your task.
In your ASPX file add the following:

<asp:DataList ID="dlstTopicsInDiscussion" runat="server" CellPadding="0" ForeColor="Black"
 ShowFooter="False" ShowHeader="False" Width="99%" BorderColor="#83CCC3" BorderStyle="None">
    <ItemTemplate>
    <table width="100%" cellpadding="0" cellspacing="0">
    <tr>
       <td class="RightMenuOutlineBKG" style="width: 1px; height: 21px;"></td>
       <td style="width: 96%; height: 21px; text-align: left;">
        <asp:HyperLink ID="hlTopicsInDiscussion" runat="server" 
         Font-Bold="false" Font-Underline="false" ForeColor="Black" 
         Text='<%#("&nbsp;") +  Eval("Topic") %>'
         ToolTip='<%# "Last post by: " + Eval("LastUserName")+"\r\n on: " + Eval("LastPosted") + "\r\n posted to: " + Eval("Forum") %>'
         NavigateUrl='<%#(System.Configuration.ConfigurationManager.AppSettings["ForumPageInternal"]) + ("?g=posts&t=") + Eval("TopicID") %>'
         Width="98%"></asp:HyperLink>
       </td>
    </tr>
   </table>
   </ItemTemplate>
</asp:DataList>


In code behind add the following and call it from Page Load:

	private void PopulateTopicsInDiscussion()
	{

		DataTable dt = ((DataTable)(Cache["TopicsInDiscussion"]));
		if (dt == null)
		{
			try
			{
			
				dlstTopicsInDiscussion.DataSource = null;
				dt = yaf.DB.topic_latest(1, 5, 1);
				if (dt.Rows.Count < 1)
				{
					//try again
					return;
				}
				DateTime dtExpiry = DateTime.Now.AddHours(m_nCacheExpirationTime);
				Cache.Insert("TopicsInDiscussion", dt, null,
					dtExpiry, System.Web.Caching.Cache.NoSlidingExpiration);

			}
			catch
			{
				//do whatever you want...
				return;
			}
		}
		dlstTopicsInDiscussion.DataSource = dt;
		dlstTopicsInDiscussion.DataBind();
	}



Hope this will solve your problem.
Happy Coding...
-muneeb
test2005
2008-08-27T02:37:52Z
Why not use the RSS function?

.....the man in black fled across the desert..........and the gunslinger followed.....

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved