C
chris.c.woodward
This event seems to be being raised twice in my codebehind. I have
only one SelectMethod and do not have a SelectCountMethod. Its causing
a problem because I'm dynamically loading a user control into a
PlaceHolder control in the method and am having to do a check to see
if it already exists or not otherwise it gets loaded twice. Also it
would be nice to figure out what the heck is going on! Here is the
code ...
protected void odsCatalogues_Selected(object sender,
ObjectDataSourceStatusEventArgs e)
{
Response.Write("event called");
Response.Write("<br />");
if (e.ReturnValue != null)
{
PagedDataSource pds = (PagedDataSource)e.ReturnValue;
totalRowCount = pds.DataSourceCount;
lblPageInfo.Text = totalRowCount + " records found. Page "
+ (pageIndex + 1) + " of " + pageCount;
if (PlaceHolder1.Controls.Count == 0)
{
Control control1 = Page.LoadControl("~/UserControls/
NumericPager.ascx");
UserControls_NumericPager numericPager1 =
(UserControls_NumericPager)control1;
numericPager1.PageCount = pageCount;
numericPager1.PageIndex = pageIndex;
PlaceHolder1.Controls.Add(numericPager1);
}
}
}
Anybody got any ideas why this event is being called twice?
only one SelectMethod and do not have a SelectCountMethod. Its causing
a problem because I'm dynamically loading a user control into a
PlaceHolder control in the method and am having to do a check to see
if it already exists or not otherwise it gets loaded twice. Also it
would be nice to figure out what the heck is going on! Here is the
code ...
protected void odsCatalogues_Selected(object sender,
ObjectDataSourceStatusEventArgs e)
{
Response.Write("event called");
Response.Write("<br />");
if (e.ReturnValue != null)
{
PagedDataSource pds = (PagedDataSource)e.ReturnValue;
totalRowCount = pds.DataSourceCount;
lblPageInfo.Text = totalRowCount + " records found. Page "
+ (pageIndex + 1) + " of " + pageCount;
if (PlaceHolder1.Controls.Count == 0)
{
Control control1 = Page.LoadControl("~/UserControls/
NumericPager.ascx");
UserControls_NumericPager numericPager1 =
(UserControls_NumericPager)control1;
numericPager1.PageCount = pageCount;
numericPager1.PageIndex = pageIndex;
PlaceHolder1.Controls.Add(numericPager1);
}
}
}
Anybody got any ideas why this event is being called twice?