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

RadGrid RowIndex on LinkClick

1 Answer 50 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mahesh Babu
Top achievements
Rank 1
Mahesh Babu asked on 28 Aug 2009, 04:57 PM
Hi,

I have a radGrid which has links generated by GridButtonColumn. Customer can click on these links which posts back to the same page. Now, I want to know which row, link click is happend so that by using that RowID I can go to DataTable( datasource for radGrid) and fetch that row data to perform some business logic.

Please help.

Mahesh

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 29 Aug 2009, 05:20 AM
Hi Mahesh Babu,

Try the following code snippet for getting the index/cell value of clicked row.

ASPX:
 
  . . . 
<Columns> 
    <telerik:GridButtonColumn Text="MyButton" CommandName="MyButtonClick"
    </telerik:GridButtonColumn>     
    <telerik:GridBoundColumn DataField="CustomerID" HeaderText="CustomerID" SortExpression="CustomerID" 
        UniqueName="CustomerID"
    </telerik:GridBoundColumn> 
     . . . 
</Columns> 
  . . . 

C#:
 
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
    if (e.CommandName == "MyButtonClick"
    { 
        Response.Write((e.Item as GridDataItem).ItemIndex); 
        Response.Write((e.Item as GridDataItem)["CustomerID"].Text); 
    } 

-Shinu.
Tags
Grid
Asked by
Mahesh Babu
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or