473,387 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to retrieve a column from a selected GridView row.

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

Apr 20 '07 #1
1 1948
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" <st***********@yahoo.comwrote in message
news:11**********************@e65g2000hsc.googlegr 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

Apr 28 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: george_Martinho | last post by:
It seems that the ASP.NET Microsoft team didn't think about this!! The profilemanager class has the following methods: - DeleteInactiveProfiles. Enables you to delete all profiles older than a...
0
by: GMartin | last post by:
I have a pop-up form with a three columned Grid that has checkboxes in a Template Column in the first/left-most column. (The form is to allow users to select "Members" of a group, where they check...
3
by: jobs | last post by:
I have a gridview on another page with a column that will link to this page. I'm flirting with design options, but am considering a template field with hyperlink navigateurl that includes a query...
1
by: Neven Klofutar | last post by:
Hi, I have a questin regarding GridView, Template column and Checkbox in it. I'm working on a project that has several "client" applications entering data into DB, and one "admin" application...
9
by: Mel | last post by:
I have 10 columns total. 3 of them are invisible. The rest are read- only BoundFields, 3 of which are editable fields using TemplateFields. Upon editing, I want to validate what the user enters...
2
by: Valli | last post by:
Hi, I am using a gridview to display data from table. In the gridview, there are 5 columns in which one column contains link name(eg. http://www.msn.com). I want to show this link as an...
2
by: rameshgohil | last post by:
I am using grid view and a button column in it using <itemTemplate> but I am not able to rerive cell value of a selected row from grid view. I have tried the following to methods in Row_command...
2
by: gnewsgroup | last post by:
I have a GridView, in which the header of one column changes depending on the selected value of a DropDownList outside of this GridView. I did this dynamic header through protected void...
2
by: =?Utf-8?B?UGF1bA==?= | last post by:
In the code below the first line works to read data from the gridview control but the second line the ltest label is null. The very first column of the grid is a bound data item that I converted...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.