1. Add attribute OnItemCommand to <Telerik:RadGrid>, for example "OnItemCommand="radGrid1_ItemCommand" if your grid name is radGrad1
2. Add attribute EnablePostBackOnRowClick="true" to <ClientSettings>
3. To your code behind, add the following, which will assign a specific cell value to a string:
protected void radGrid1_ItemCommand { // this block will take the value of the column "ContactName" from the grid and assign it to a string if (e.CommandName == "RowClick") { int index = e.Item.ItemIndex; GridDataItem item = (GridDataItem)radGrid1.Items[index]; string contactName = item["ContactName"].Text; } }
Customizing gridview control in C#.NET
ReplyDelete