Need help in programmatically accessing the data returned by data access method...

S

Siva

Hi,
In my ASP.Net 2.0 app, I have a gridview whose data is being
populated using an object data source which retrieves data from a data
access layer. The Select method returns a static list of orders. The
order contains a bunch of data retrieved from SQL server.
I do display only a part of them in my Gridview by using
<asp:BoundField. I do , however need to access the remaining fields
which are part of the order programmatically from my codebehind file.
Can anyone help with how I can go about doing that?

Thanks
-Siva Ramaswami
 
G

Guest

Siva...

You didn't say what specific class the "object data source" belongs to. As
long as it's not database attached (like a SqlDataReader, for example), you
should be able to simply set a reference to it, in code-behind, and access
any data it contains via that reference. If you need that data on subsequent
round-trips, just persist the reference in session state.

By some definitions, a "data access layer" is stateless, which might mean
that it will be up to you to persist any data that it returns (potentially,
placing a reference in session state would still be sufficient). You
indicated that "The Select method returns a static list of orders". If it is
an ArrayList, for example, you just need to declare an arraylist and code
your call to the Select method to return its results to that reference.
Then, set the DataSource property of your GridView to that same reference.

So, determine what class you are dealing with, and go from there.

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,744
Messages
2,569,479
Members
44,900
Latest member
Nell636132

Latest Threads

Top