How to programmatically access ObjectDataSource values

A

avezina

We would like to use those new cool features of Asp.Net 2.0 like the
ObjectDataSource in our project. I tried few basics examples and its
work well.

Let's say I have a page that displays a detail of a product. On my
page I have a product name and a short description. So I declare an
ObjectDataSource in my page

<asp:ObjectDataSource ID="productData" runat="server"
SelectMethod="GetProduct"
TypeName="MyRedmond.Gumsnet.WebUi.UiProcess.Controller.ProductContentController">
<SelectParameters>
<asp:parameter DefaultValue="10" Name="productID"
Type="Object" />
</SelectParameters>
</asp:ObjectDataSource>

Now I can bind this ObjectDataSource to any data control, but in this
case I want to display information at many places in my page using this
single ObjectDataSource. So I want to be able to programmatically
access ObjectDataSource values, but the Question is HOW?

Alain Vezina
(e-mail address removed)
 
B

Brock Allen

You can access the ObjectDataSource's SelectParameters from anywhere on the
page and change the DefaultValue to anything you'd like. Also, you can handle
the ObjectDataSource's Selecting event and then modify the parameters for
that one select by adding or chaninging the ObjectDataSourceSelectingEventArgs's
InputParameters. HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top