GridView and DataBinding (ADO.NET/ASP.NET)

How do I access the entire dataset/datatable in a gridview?  I am using data binding just a SqlDataSource (SqlDataSource1) configured to execute a stored proc passing some values from controls on a page.  The GridView control has it's DataSourceID set to SqlDataSource1.  I know how to use the DataSource property when manually writing the code, however I am modifying an exisiting application so I have some limitations without refactoring a ton of code.

On the click event of a button I need to access the data in the current grid (I am trying to avoid running the query again if at all possible).

Make sense?  Any thoughts?


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I think you will have to use the DataBinding or DataBound of the Grid Control, You will have to store the DataSet in a variable during that event, so that you can later have access to it.

or probably the SQLDataSource DataBound event.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
You can access data in the gridview by using
Hope this helps
eferronAuthor Commented:
I have to have paging enabledso the grid does not have all of the data in only the current page.  I think I have determined that I will need to reexecute the query.
eferronAuthor Commented:
Not really what I was looking for but it is close enough
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.