嵌套网格中的下拉列表问题 [英] Issue with dropdown list in nested grid

查看:69
本文介绍了嵌套网格中的下拉列表问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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: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>





< b>我有什么试过:



将子网格中的下拉列表包含在更新面板中,并带有异步回发触发器



What I have tried:

wrapped dropdown list in child grid into update panel with async post back trigger

推荐答案

资源:CIP,Label_Header_ddlAllocated %> >
< ItemTemplate >
< asp:UpdatePanel ID = UpdatePanel1 runat = server EnableViewState = true UpdateMode = 条件 >
< ContentTemplate >
< asp:DropDownList ID = ddlAllocateDetails runat = server AutoPostBack = true EnableViewState = true 宽度 = 140px OnSelectedIndexChanged = ddlAllocated_SelectedIndexChanged > < / asp:DropDownList >
< / ContentTemplate >
< 触发器 >
< asp:AsyncPostBackTrigger ControlID = ddlAllocateDetails EventName = SelectedIndexChanged < span class =code-attribute> / >
< / Triggers >
< / asp:UpdatePan el >
< / ItemTemplate >
< ItemStyle 宽度 = 140px / >
< / asp:TemplateField >
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


我使用以下更改了实现PO ST。它解决了这个问题。



使用ASP.Net进行分页的可折叠嵌套GridView [ ^ ]
I changed the implementation using below post. It resolved the issue.

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


这篇关于嵌套网格中的下拉列表问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆