Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Retrieve data from a specific cell in Gridview

Posted on 2008-06-17
2
Medium Priority
?
3,034 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 750 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 750 total points
ID: 21803322
if you know what row was hit, then you could use
GridView1.Rows[intRow].Cells[myCell].Text
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

596 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