Home All Groups Group Topic Archive Search About

Access ObjectDataSource data from asp.net codebehind

Author
4 Apr 2006 2:25 AM
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

Author
4 Apr 2006 7:09 AM
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."
Author
4 Apr 2006 5:08 PM
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
Author
5 Apr 2006 3:15 AM
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."
Author
5 Apr 2006 10:20 PM
Jeronimo Bertran
ok   Thanks
Author
6 Apr 2006 5:56 AM
Kevin Yu [MSFT]
You're welcome.

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

AddThis Social Bookmark Button