我有以下telerik网格,需要将嵌套表中的数据值传递到ItemCommand中,因此当用户单击网格按钮时,代码被执行,我被困在哪里去
<telerik:RadGrid ID="grdRegions" runat="server" Skin="Metro" AllowCustomSorting="True"
ShowHeader="True" PageSize="10" ShowGroupPanel="False" OnItemCommand="grdRegions_ItemCommand"
ShowStatusBar="True" AutoGenerateColumns="False"
AllowSorting="True" AllowPaging="True" DataSourceID="RegionDS" Width="500px">
<PagerStyle Mode="Slider" />
<MasterTableView DataSourceID="RegionDS" DataKeyNames="RegionCode" AllowMultiColumnSorting="True" Width="100%">
<DetailTables>
<telerik:GridTableView runat="server" DataKeyNames="RegionCode,DealerId" DataSourceID="DealerDS" AllowFilteringByColumn="True" >
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="RegionCode" MasterKeyField="RegionCode" />
</ParentTableRelation>
<Columns>
<telerik:GridBoundColumn SortExpression="DealerId" HeaderText="Dealer" HeaderButtonType="TextButton"
DataField="Dealer" UniqueName="DealerId">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="RegionCode" HeaderText="FDAF Region Code" HeaderButtonType="TextButton"
DataField="RegionCode" UniqueName="RegionCode" AllowFiltering="False">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="DealerId" HeaderText="DealerId" HeaderButtonType="TextButton"
DataField="DealerId" UniqueName="Dealer">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn ItemStyle-Width="22px" AllowFiltering="false">
<ItemTemplate>
<asp:ImageButton ID="EditDealer" runat="server" AlternateText="Edit Dealer" ToolTip="Edit Dealer"
ImageUrl="Images/edit.png" CommandArgument='<%# DataBinder.Eval(Container,"DataItem.DealerId")%>'
CommandName="EditDealer" CausesValidation="false" />
</ItemTemplate>
<ItemStyle Width="22px"></ItemStyle>
</telerik:GridTemplateColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
<Columns>
<telerik:GridBoundColumn SortExpression="RegionName" HeaderText="FDAF Region" HeaderButtonType="TextButton"
DataField="RegionName" UniqueName="RegionName" AllowFiltering="False">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="RegionCode" HeaderText="FDAF Region Code" HeaderButtonType="TextButton"
DataField="RegionCode" UniqueName="RegionCode">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="RegionDealerCount" HeaderText="Dealers In Region" HeaderButtonType="TextButton"
DataField="RegionDealerCount" UniqueName="RegionDealerCount" AllowFiltering="False">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
protected void grdRegions_ItemCommand(object sender, GridCommandEventArgs e)
{
objDealerDL.DealerId = Convert.ToInt32((e.Item as GridDataItem).OwnerTableView.DataKeyValues[e.Item.ItemIndex]["DealerId"].ToString());
GridDataItem item = (GridDataItem)e.Item;
if (e.CommandName == "EditDealer")
{
try
{
do work
}
catch (Exception ex)
{
}
}
}