Access ObjectDataSource data from asp.net codebehind

  • Thread starter Jeronimo Bertran
  • 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
 
K

Kevin Yu [MSFT]

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."
 
J

Jeronimo Bertran

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
 
K

Kevin Yu [MSFT]

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."
 
K

Kevin Yu [MSFT]

You're welcome.

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

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

Top