Hello, I have a grid bound to an xml file and I am using a GridEditCommandColumn to edit the record. But when I click this button, I am getting a js error "Problem extracting DataKeyValues from DataSource" and I do not see the edit form. The edit works for the MasterTableView, but not on the DetailTable.
Below is my grid followed by how I populate the second level details table:
how i populate the second level grid:
Any help would be appreciated.
Thanks
Below is my grid followed by how I populate the second level details table:
<telerik:RadGrid ID="RadGrid1" DataSourceID="XmlDataSource1" runat="server" ShowStatusBar="true" |
AutoGenerateColumns="False" PageSize="3" AllowSorting="True" AllowMultiRowSelection="False" |
AllowPaging="True" GridLines="None" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" |
AllowAutomaticUpdates="True" OnItemUpdated="RadGrid1_ItemUpdated" |
OnInsertCommand="RadGrid1_InsertCommand" OnItemCommand="RadGrid1_ItemCommand"> |
<PagerStyle Mode="NumericPages"></PagerStyle> |
<MasterTableView DataSourceID="XmlDataSource1" DataKeyNames="ServerID" AllowMultiColumnSorting="True" |
Width="100%" CommandItemDisplay="Top" Name="Servers" AutoGenerateColumns="false"> |
<DetailTables> |
<telerik:GridTableView DataKeyNames="SystemID" DataSourceID="XmlDataSource2" Width="100%" |
runat="server" CommandItemDisplay="Top" Name="Systems" AutoGenerateColumns="false"> |
<Columns> |
<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn2"> |
<HeaderStyle Width="20px" /> |
<ItemStyle CssClass="MyImageButton" /> |
</telerik:GridEditCommandColumn> |
<telerik:GridBoundColumn SortExpression="LoginUrl" HeaderText="Login URL" HeaderButtonType="TextButton" |
DataField="LoginUrl" UniqueName="LoginUrl"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn SortExpression="LogoutUrl" HeaderText="LogoutUrl" |
HeaderButtonType="TextButton" DataField="LogoutUrl" UniqueName="LogoutUrl"> |
</telerik:GridBoundColumn> |
</Columns> |
</telerik:GridTableView> |
</DetailTables> |
<Columns> |
<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn"> |
<HeaderStyle Width="20px" /> |
<ItemStyle CssClass="MyImageButton" /> |
</telerik:GridEditCommandColumn> |
<telerik:GridBoundColumn SortExpression="ServerID" HeaderText="ServerID" HeaderButtonType="TextButton" |
DataField="ServerID" UniqueName="ServerID" ReadOnly="true"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn SortExpression="Name" HeaderText="Name" HeaderButtonType="TextButton" |
DataField="Name" UniqueName="Name"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn SortExpression="Group" HeaderText="Group" HeaderButtonType="TextButton" |
DataField="Group" UniqueName="Group"> |
</telerik:GridBoundColumn> |
</Columns> |
</MasterTableView> |
</telerik:RadGrid> |
how i populate the second level grid:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) |
{ |
if (e.CommandName == RadGrid.ExpandCollapseCommandName ) |
{ |
XmlDataSource2.XPath = String.Format("Servers/Server[@ServerID='{0}']/System", ((GridDataItem)e.Item).GetDataKeyValue("ServerID")); |
} |
} |
Any help would be appreciated.
Thanks