Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 15-01-2009
Member
 
Join Date: Dec 2008
Posts: 7
Getting data from a selected row in gridview in VB.Net

Hi,

I have a gridview which is being populated with no problems.
I want to be able to reference the data from the cells in the row
Can anyone provide me with the code that will allow me to access the
data in each cell.
Reply With Quote
  #2  
Old 15-01-2009
Member
 
Join Date: May 2008
Posts: 2,383
Re: Getting data from a selected row in gridview in Asp.Net

// Copy the items in the Rows collection into an array.

GridViewRow[] rowArray = new GridViewRow[gv.Rows.Count];
gv.Rows.CopyTo(rowArray, 0);

// Iterate though the array and display the value in the first cell of the row.

int j = -1;
foreach (GridViewRow row in rowArray)
{
j++;
if (j == idx)
{
Label1.Text = row.Cells[1].Text;
}
}
Reply With Quote
  #3  
Old 15-01-2009
Member
 
Join Date: Apr 2008
Posts: 2,001
Re: Getting data from a selected row in gridview in Asp.Net

You can do it simply by using this given code.

dim string1 as string

string1 = gridview1.rows(row#).cells(cell#).text.tostring
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Getting data from a selected row in gridview in VB.Net"
Thread Thread Starter Forum Replies Last Post
Extracting Selected Data from a txt file sidney786 Software Development 3 20-08-2010 01:07 AM
Retrieve selected Data From a Table samualres Software Development 5 30-01-2010 10:04 AM
Datagrid VS Gridview Techno Guru Software Development 5 16-01-2010 12:42 PM
How to use Gridview ImageField in DataImageUrlFormatString on ASP.net AK_Chopra Software Development 2 08-06-2009 09:54 PM
asp.net gridview to pdf Dietrich Software Development 1 05-02-2009 12:15 PM


All times are GMT +5.5. The time now is 07:01 AM.