Friday, June 12, 2009

Finding Total Records / Total Count returned By Object Datasource SelectCountMethod

Often SelectCountMethod may be int or long so check the type in object datasource Selected event and store the value in ViewState or a variable so it can be used in the page

protected void odSource_Selected(object sender, ObjectDataSourceStatusEventArgs e)
{
if (e.ReturnValue.GetType() == typeof(Int32))
{
ViewState["TotalCount"] = e.ReturnValue;
}
}

No comments: