Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to retrieve a column from a selected GridView row.

Reply
Thread Tools

How to retrieve a column from a selected GridView row.

 
 
Steve Kershaw
Guest
Posts: n/a
 
      04-20-2007
Hi,

I have a GridView in which I have selected a row. I now want to use
the 1st column value of that selected row in another GridView as an
input to select the particular row in the second GridView. I know that
"GridView1.SelectedRow.Cells[0]" dosen't work along with some other
things I have tried.

Can anybody help me with this?!

Thanks in advance.
Steve

 
Reply With Quote
 
 
 
 
Randy Smith
Guest
Posts: n/a
 
      04-28-2007
Hi,
I've got this code, and seems to work quite well:

foreach (GridViewRow row in GridView1.Rows)
{
CheckBox chk1 = (CheckBox) row.FindControl("chk1");
if (chk1.Checked == true)
{
//code goes here
}
}

The point of this code is that it is necessary to "find" the control, and
place the contents into a newly created variable. In the case above, the
variable is "chk1", but it can be anything. Although it might be confusing,
the name of the control on the aspx form is also "chk1".

HTH, Randy




"Steve Kershaw" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> Hi,
>
> I have a GridView in which I have selected a row. I now want to use
> the 1st column value of that selected row in another GridView as an
> input to select the particular row in the second GridView. I know that
> "GridView1.SelectedRow.Cells[0]" dosen't work along with some other
> things I have tried.
>
> Can anybody help me with this?!
>
> Thanks in advance.
> Steve
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
gridview column values to another page via gridview hyperlink column Keith G Hicks ASP .Net 3 02-18-2008 06:17 AM
GridView - Retrieve invisible column information Mel ASP .Net 9 08-09-2007 03:04 PM
bind a dropdown in a column in a datagrid based on the dropdown value selected in another column of the datagrid. vishnu ASP .Net 1 03-25-2006 01:24 PM
how do i access a dropdownlists selected value in a datagrid edititemtemplate column from the selectedindexchanged event of another dropdownlist in a datagrid edititemtemplate column Dave M ASP .Net Datagrid Control 0 12-14-2004 11:53 AM



Advertisments