Hello,
I have another problem, and I hope someone can give me a clue.
I tryed to put a nested Gridviews (parent-child) in an UpdatePanel, but it didn 't work as I want. Firstly the code of the Gridview (its from the example reffering to this http://aspsnippets.com/Articles/Multilevel-N-Level-Nested-GridView-GridView-inside-GridView-in-ASPNet-with-Paging.aspx)
<form id="form1" runat="server">
<asp:ScriptManager ID="scriptMgr" runat="server" EnablePartialRendering="true" />
<asp:UpdatePanel ID="updatePnl" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="gvCustomers" runat="server" AutoGenerateColumns="False" CssClass="Grid"
DataKeyNames="CustomerID" onrowcommand="RowCommand1">
<Columns> <asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="imgOrdersShow" runat="server" OnClick="Show_Hide_OrdersGrid" ImageUrl="~/images/plus.png"
CommandArgument="Show" />
<asp:Panel ID="pnlOrders" runat="server" Visible="false" Style="position: relative">
<asp:GridView ID="gvOrders" runat="server" AutoGenerateColumns="false"
CssClass="ChildGrid"
DataKeyNames="OrderId" onrowcommand="RowCommand2">
<Columns>
<asp:BoundField ItemStyle-Width="150px" DataField="OrderId" HeaderText="Order Id" />
<asp:BoundField ItemStyle-Width="150px" DataField="OrderDate" HeaderText="Date" />
<asp:ButtonField Text="Schaltfläche" CommandName="ClickLVL2" />
</Columns>
</asp:GridView>
</asp:Panel> </ItemTemplate>
</asp:TemplateField>
<asp:BoundField ItemStyle-Width="150px" DataField="ContactName"
HeaderText="Contact Name" >
<ItemStyle Width="150px"></ItemStyle>
</asp:BoundField>
<asp:BoundField ItemStyle-Width="150px" DataField="City" HeaderText="City" >
<ItemStyle Width="150px"></ItemStyle>
</asp:BoundField>
<asp:ButtonField Text="Schaltfläche" CommandName="ClickLVL1" />
</Columns> </asp:GridView>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</ContentTemplate> <Triggers>
<asp:AsyncPostBackTrigger ControlID="gvCustomers" EventName="RowCommand" />
</Triggers> </asp:UpdatePanel>
</form> </body>
In the Codebehind I put a "updatePnl.Update()" where I needed it.
I don't want a Postback on RowCommand. With this Trigger, the AsyncPostBack works well for the RowCommand, but the nested GridView won't be added in the new Row. With a PostbackTrigger it works, so I try to execute an PostbackTrigger when I click on the ImageButton. But then an exception will be thrown. When I put "
EnablePartialRendering="false"
in the scriptManager, no exception will be shown, but on RowCommand a complete Postback is done.
Any solutions for this problems?