Access ObjectDataSource data from asp.net codebehind

  • Thread starter Thread starter Jeronimo Bertran
  • Start date Start date
J

Jeronimo Bertran

Hello,

I have a web page that uses two ObjectDataSource controls to bind data to a
FormView and a grid .

In my grid which is bound to ObjectDataSource2, I want to add in the footer
information from certain fields from the first ObjectDataSource. I am
using the DataBound event to add data to the footer but I can't find a way
to access the underlying tables of the ObjectDataSource.

Thanks.

Jeronimo
 
Hi Jeronimo,

The ObjectDataSource creates data source at runtime. You can get the object
instance in the ObjectDataSource.ObjectCreated event. In the
ObjectDataSourceEventArgs, the ObjectInstance property is the reference to
the created data source object.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Hi Kevin,

Thanks for the post. The ObjectInstance as you mentioned returned de data
source object. But how can I access the underlying dataset that was
populated through the object's select statement?


Thanks again,

Jeronimo
 
Hi Jeronimo,

To access the DataSet that populates the objects, you need to write extra
code in the object class. For example, you can put a property in the class,
so when we get that object, we can get the DataSet from the property. HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
You're welcome.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top