?
Solved

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

Posted on 2008-11-08
4
Medium Priority
?
766 Views
Last Modified: 2013-12-17
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?

Thanks,

Ed
0
Comment
Question by:eferron
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
wguerram earned 150 total points
ID: 22913526
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.
0
 
LVL 6

Expert Comment

by:M3mph15
ID: 22918719
Hi,
You can access data in the gridview by using
GridView1.Rows([rowindex]).Cells(]cellindex]).Text
Hope this helps
-M3mph15
0
 

Author Comment

by:eferron
ID: 22920930
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.
 
thanks...
 
 
Ed
0
 

Author Closing Comment

by:eferron
ID: 31514671
Not really what I was looking for but it is close enough
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Loops Section Overview
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question