T
Tim
I have a datagrid that is nested inside of another datagrid. The code
is below.
The datagrids display correctly, however, I cannot edit the inner
datagrid as I haven't been able to correctly reference it. The Edit
command is also below.
How can I correctly reference the inner datagrid to edit it?
Thanks,
Tim
<aspatagrid... >
<asp:BoundColumn ...>
<asp:BoundColumn ...>
<asp:TemplateColumn>
<ItemTemplate>
<aspataGrid runat="server" id="dgSub"
OnEditCommand="dgSub_Edit"
DataSource='<%#
((DataRowView)Container.DataItem).Row.GetChildRows("GroupNameRelations")
%>'>
<asp:TemplateColumn HeaderText="Local Group Name">
<ItemTemplate>
<%# DataBinder.Evalontainer.DataItem, "LocalGroupName")
%> </ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtLocalGroupName" Runat="server"
Text='<% DataBinder.Eval(Container.DataItem, "LocalGroupName") %>'
/> </EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Button ID="btnLocalEdit" Runat="server"
CommandName="Edit" Text="Edit" />
</ItemTemplate>
<EditItemTemplate>
<asp:Button ID="btnLocalUpdate" Runat="server"
CommandName="Update" Text="Update" />
<asp:Button ID="btnLocalCancel" Runat="server"
CommandName="Cancel" Text="Cancel" />
</EditItemTemplate>
</asp:TemplateColumn>
</aspataGrid>
</aspataGrid>
The edit command currently looks like:
protected void dgLocalGroups_Edit(object sender,
DataGridCommandEventArgs e)
{
DataGrid dgLocalGroups =
(DataGrid)dgGroups.FindControl("dgLocalGroups");
// get the row that was clicked
int intRow = e.Item.ItemIndex;
dgLocalGroups.EditItemIndex = intRow;
}
is below.
The datagrids display correctly, however, I cannot edit the inner
datagrid as I haven't been able to correctly reference it. The Edit
command is also below.
How can I correctly reference the inner datagrid to edit it?
Thanks,
Tim
<aspatagrid... >
<asp:BoundColumn ...>
<asp:BoundColumn ...>
<asp:TemplateColumn>
<ItemTemplate>
<aspataGrid runat="server" id="dgSub"
OnEditCommand="dgSub_Edit"
DataSource='<%#
((DataRowView)Container.DataItem).Row.GetChildRows("GroupNameRelations")
%>'>
<asp:TemplateColumn HeaderText="Local Group Name">
<ItemTemplate>
<%# DataBinder.Evalontainer.DataItem, "LocalGroupName")
%> </ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtLocalGroupName" Runat="server"
Text='<% DataBinder.Eval(Container.DataItem, "LocalGroupName") %>'
/> </EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Button ID="btnLocalEdit" Runat="server"
CommandName="Edit" Text="Edit" />
</ItemTemplate>
<EditItemTemplate>
<asp:Button ID="btnLocalUpdate" Runat="server"
CommandName="Update" Text="Update" />
<asp:Button ID="btnLocalCancel" Runat="server"
CommandName="Cancel" Text="Cancel" />
</EditItemTemplate>
</asp:TemplateColumn>
</aspataGrid>
</aspataGrid>
The edit command currently looks like:
protected void dgLocalGroups_Edit(object sender,
DataGridCommandEventArgs e)
{
DataGrid dgLocalGroups =
(DataGrid)dgGroups.FindControl("dgLocalGroups");
// get the row that was clicked
int intRow = e.Item.ItemIndex;
dgLocalGroups.EditItemIndex = intRow;
}