Solved

Retrieve data from a specific cell in Gridview

Posted on 2008-06-17
2
3,032 Views
Last Modified: 2013-12-16
I have a Gridview connected to a datasource in my C# code. I now wish to retrieve some data from this GW without asking the DB. The data sould be collected from a certain row when a checkbox has been triggered. In the example below I was able to retrieve the data corresponding to a key in the GW. The question is: How do I retrieve data from the other colums which are not keys in the GW?

Buddah bless
string tmp = ((long)GridView1.DataKeys[((GridViewRow)cb.NamingContainer).RowIndex][1]).ToString();

Open in new window

0
Comment
Question by:jide85
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 22

Accepted Solution

by:
prairiedog earned 250 total points
ID: 21803295
Assume i is the index of the row that is triggered by the checkbox, and j is the specific cell that you are interested in. You can get the value like this:
GridViewRow gvr = GridView1.Rowsii];
string tmp = gvr.Cells[j-1].Text              // the index of the cells starts from 0
0
 
LVL 16

Assisted Solution

by:burakiewicz
burakiewicz earned 250 total points
ID: 21803322
if you know what row was hit, then you could use
GridView1.Rows[intRow].Cells[myCell].Text
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

691 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