开发者

ASP.NET [Object data source]

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;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜