I send id of my class object from one page to second thi开发者_运维知识库s way :
NavigateUrl='<%# "ItemDetail.aspx?itemId=" + (string)Eval("Id") %>'
Then I get the object with ObjectDataSource and function this way :
<asp:ObjectDataSource ID="ObjectDataSourceItem" runat="server" SelectMethod="GetItem"
TypeName="Catalog">
<SelectParameters>
<asp:QueryStringParameter Name="itemId" QueryStringField="itemId" Type="string" DefaultValue="" />
</SelectParameters>
</asp:ObjectDataSource>
So how to use this item in my new page code :
this.ObjectDataSourceItem.?????
You need to subscribe to the ObjectDataSource's Selected event, access the ObjectDataSourceStatusEventArgs ReturnValue property (e.ReturnValue), and cast it to the appropriate type. Something like:
protected void ObjectDataSourceItem_Selected(object source, ObjectDataSourceStatusEventArgs e)
{
var myDataSet = (DataSet)e.ReturnValue;
}
精彩评论