How do I tell if the ObjectDataSource OnSelected event was called for the selectmethod or selectcou
Posted
by itchi
on Stack Overflow
See other posts from Stack Overflow
or by itchi
Published on 2010-05-26T18:09:29Z
Indexed on
2010/05/26
18:11 UTC
Read the original article
Hit count: 167
I have an object datasource that looks like this:
<asp:ObjectDataSource ID="obdsList" runat="server"
EnablePaging="True" SelectCountMethod="GetCountByID" SortParameterName="sortExpression"
OldValuesParameterFormatString="original_{0}" SelectMethod="GetByID"
TypeName="Services.Users"
onselected="obdsList_Selected">
<SelectParameters>
<asp:QueryStringParameter Name="ID" QueryStringField="ID"
Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
And a onselected event like this:
protected void obdsList_Selected(object sender, ObjectDataSourceStatusEventArgs e) {
}
However, the event method is being called twice.. once with my returned list, and once with the returned Int32 count. If I want to cast e.ReturnValue
to the return List how do I differentiate between the count and select methods? I can do a e.ReturnValue.GetType().ToString()
but that seems like a hack.
© Stack Overflow or respective owner