Click here to Skip to main content
15,894,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
I am implementing a nested grid view. I referred to below link for implementation

http://www.aspsnippets.com/Articles/ASPNet-Nested-GridViews-GridView-inside-GridView-with-Expand-and-Collapse-feature.aspx

I have a dropdown "Allocate" in the Parent grid and Child grid. The requirement is to remove the dropdown item if it is selected in any row. For that, I have selected index change event to have code piece where it removes the selected item and re-binds the dropdown in other rows. The issue is : Whenever the dropdown value is changed in the child, the grid collapses and hides child grid. To resolve this I wrapped dropdown list in child grid into update panel with async post back trigger so, that it can have partial post back. But, now it is not firing selected index change event. Please help to resolve the issue.

-------------------------------------------------------------------
   A     | B   | C | Allocate
-------------------------------------------------------------------
- Test   | 100 | 50 |          ----> Parent
__________________________________________________________________
  Test a | 50  | 25 | [Select] ------> Child
  Test b | 50  | 25 | [Select] ------> Child
__________________________________________________________________

+ Test1  | 50  | 25 |          ----> Parent

  Test 2 | 50  | 25 | [Select] ----> Parent with no child


ASP.NET
<asp:TemplateField HeaderText="<%$ Resources:CIP,Label_Header_ddlAllocated%>">
                              <ItemTemplate>
                                  <asp:UpdatePanel ID="UpdatePanel1" runat="server" EnableViewState="true" UpdateMode="Conditional">
                                      <ContentTemplate>
                                          <asp:DropDownList ID="ddlAllocateDetails" runat="server" AutoPostBack="true" EnableViewState="true" Width="140px" OnSelectedIndexChanged="ddlAllocated_SelectedIndexChanged"></asp:DropDownList>
                                      </ContentTemplate>
                                      <Triggers>
                                          <asp:AsyncPostBackTrigger ControlID="ddlAllocateDetails" EventName="SelectedIndexChanged" />
                                      </Triggers>
                                  </asp:UpdatePanel>
                              </ItemTemplate>
                              <ItemStyle Width="140px" />
                          </asp:TemplateField>


What I have tried:

wrapped dropdown list in child grid into update panel with async post back trigger
Posted
Updated 11-Aug-16 10:25am

1 solution

I changed the implementation using below post. It resolved the issue.

Collapsible Nested GridView with Paging using ASP.Net[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900