Click here to Skip to main content
15,919,434 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have a grid view with this Columns :

Column 1: Id (label) Bind From Table
Column 2:Name(TextBox) Bind From Table
Column 3: Button Or Hyperlink

and I have a SqldataSourse that bind Id And Name from Table

i want index or Name(value in textbox) Of A Column(Selected Column) by Clicking on the Button(or Hyperlink)
for rediredt to other webpage(example See Other...)

I want a C# Code that Give Me Index or DataKeyNames Of Selected Row Button(Or Hyperlink)


PLZ HELP ME
Posted
Comments
Nelek 31-May-12 19:41pm    
What have you tried? Where are you having problems? Just ask for running code is not a good practice, since you won't learn anything usefull.

1 solution

Hi,

Are you pertaining to the value of the row which is primaryKey? if so, here are the code.


to get the CurrentRows PrimaryKey or DataKeyNames:


C#
DatagridView1.Rows[DatagridView1.CurrentCell.RowIndex].Cells["ID"].Value.ToString() 
 
Share this answer
 
Comments
sadegh_rusta 6-Jun-12 16:24pm    
i have a grid view not a data grid view

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900