Quote:
quote:Originally posted by Maxxim
How do you bind your forumCategories and forumCategoriesForums? With a single connection? Or first you bind all categories to your ajax top panel and then bind (with n sqlConnections) the list of forums for each of n categories?
|
Max,
I use a repeater with objCategories as the datasourceID. objCategories is populated from GetCategories(). I also have objAllForums which is populated with a method that calls GetForums(int32 CategoryID). in the Repeater1_ItemCreated event in code behind, i change the paramater string:
protected void Repeater1_ItemCreated(object sender, RepeaterItemEventArgs e)
{
Category catList = (Category)e.Item.DataItem;
if (catList != null)
{
objAllForums.SelectParameters["CategoryID"].DefaultValue = catList.ID.ToString();
GridView gv = (GridView)e.Item.FindControl("gvwForums");
//GridView gv = (GridView)CloneControl((GridView)e.Item.FindContro l("gvwForums"));
if (gv != null)
{
gv.DataSource = objAllForums;
gv.ID = catList.ID.ToString() + "_gvwForums";
gv.AutoGenerateColumns = false;
gv.DataBind();
PageView pv = new PageView();
pv.Controls.Add(gv);
// IE browser hack
if (Request.Browser.Browser.ToString() == "IE")
RadMultiPage1.Height = 20;
RadMultiPage1.PageViews.Add(pv);
string userName = COOKIE_NAME; //HttpContext.Current.Request.AnonymousID == null ? User.Identity.Name : HttpContext.Current.Request.AnonymousID;
if (Request.Cookies[userName] != null)
{
try
{
short tabIndex = short.Parse(Request.Cookies[userName].Values["_forums"]);
if (pv.Index == tabIndex)
{
pv.Selected = true;
if (RadTabStrip1.Tabs.Count > 0)
{
RadTabStrip1.Tabs[tabIndex > 0 ? tabIndex : (short)0].Selected = true;
}
}
}
catch { }
}
}
}
}
and then rebind the gridview to the objAllForums with the newly changed parameter. it's a very simple way to do it but quite effective. at the same time in this event i do my ajax stuff and add new tabs as the categories repeater item is created and then add a new gridview into a new ajax PageView, which is then added to the RadMultiPage (this is all done with telerik controls, but the same thing would be possible with MS ajax).
That's basically it - ie, just a single connection, requeried as the Repeater1_ItemCreated event is called.
hopefully, this should give you a quick start on how you'd like to implement your 'idea'
jimi
http://www.originaltalent.com