This is a migrated thread and some comments may be shown as answers.

How to Pass Data key from Rad grid view to server side

1 Answer 85 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Hamza
Top achievements
Rank 1
Hamza asked on 24 Apr 2012, 11:09 PM

Hello :)

I have a Rad grid view, which contain a button in each row

I want to do something with the data key (the primary key ) of the grid when I press a button in some row

can I retrieve the data key for used row to use it in my C# code ?

thank you all :)

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 25 Apr 2012, 05:12 AM
Hello Hamza,

Try the following code to access datakeyvalue in button click.
C#:
protected void Button3_Click(object sender, EventArgs e)
{
 foreach (GridDataItem item in grid1.MasterTableView.Items)
{
 string value = item.GetDataKeyValue("ID").ToString();
}
}

Thanks,
Shinu.
Tags
Grid
Asked by
Hamza
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or