• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 776
  • Last Modified:

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 asp.net 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?


  • 2
1 Solution
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.
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now