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

get datakey of detail grid on commandname

1 Answer 345 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 08 Feb 2012, 07:55 PM
I have a grid with one detailgird below it that has 2 datakeynames.  I need to get the value of one of the datakey names as part of the
Itemcommand event in order to tell what lkind of transaction the event should be to pull the correct sql code.  I cannot put it in the commandargument becuase I have the sql Id field here.  how can I pull the 2nd datakeyname of a detail table.

<telerik:GridTableView Name="myReIssueGrid" runat="server" DataKeyNames="intReIssueId, intTransTypeId" TableLayout="Fixed" BorderWidth="1px" CellPadding="6" Font-Size="10"
                                                AutoGenerateColumns="False" HeaderStyle-HorizontalAlign="Center" BorderColor="#404040" Font-Names="Veranda,arial,sans-serif" GridLines="Both" ExpandCollapseColumn-ButtonType="ImageButton"
                                                ExpandCollapseColumn-CollapseImageUrl="~/Images/30.png" ExpandCollapseColumn-ExpandImageUrl="~/Images/29.png">

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 09 Feb 2012, 05:19 AM
Hello Kevin,

Try the following code.
c#:
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
 if (e.CommandName=="CommandName")
 {
  string DataKey=e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["intReIssueId"].ToString();
 }
}

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