2013-05-13 3 views
0

이것은 알려진 동작입니까? 내가 어떻게 작동하게 할 수 있을까요?두 번째 UpdatePanel에서 하나의 UpdatePanel 업데이트

  • 2 개의 업데이트 패널이 있습니다. 각각 하나의 DropDownList 컨트롤이 안에 있습니다.

  • 첫 번째 DropDownList를 설정 (바인딩)하는 버튼이 하나 있습니다. 이 작품입니다.

  • 첫 번째 DropDownList를 변경하면 두 번째 DropDownList가 업데이트되어야합니다.

  • 어떤 이유로 든 두 번째 드롭 다운 목록이 업데이트되지 않습니다. 여기

은 의사입니다 - 코드 :

1 업데이트 패널 & DropDownList로 :

<asp:Button ID="btnSet" runat="server"></asp:Button> 

<asp:UpdatePanel ID="UpdatePanel1" runat="server"> 
       <ContentTemplate> 
        <asp:DropDownList ID="DropDownList1" runat="server" 
         onselectedindexchanged="DropDownList1_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList> 
       </ContentTemplate> 
        <Triggers> 
         <asp:AsyncPostBackTrigger ControlID="btnSet" EventName="Click" /> 
        </Triggers> 
      </asp:UpdatePanel> 

<asp:UpdatePanel ID="UpdatePanel2" runat="server"> 
        <ContentTemplate> 
         <asp:DropDownList ID="DropDownList2" runat="server"></asp:DropDownList> 
        </ContentTemplate> 
         <Triggers> 
          <asp:AsyncPostBackTrigger ControlID="DropDownList1" EventName="SelectedIndexChanged" /> 
         </Triggers> 
       </asp:UpdatePanel> 

코드 뒤에 :

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) 
    { 
     BindSecondDropDownList(); 
    } 

이 하나를 알아낼 도와주세요. 당신은 하나 updatepanel에 그들 모두를 병합 할 수 있습니다

http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/CascadingDropDown/CascadingDropDown.aspx

답변

1

+0

마지막으로해야 할 일이 있습니다. –

+0

약간의 도움을 주시면 감사하겠습니다. 감사. http://stackoverflow.com/questions/30352866/how-to-prevent-full-page-postback-on-selectedindexchange-for-dropdownlist – SearchForKnowledge

0

이이 드롭 다운 목록을 계단식라고하며 이에 대한 공지 된 기술, 그리고 ASP.Net 아약스에 의해 제공되는 컨트롤이 거기에 있습니다 ..., 그나마 btnSet.OnClick 이벤트를 잊어 버리십시오.

<asp:UpdatePanel ID="UpdatePanel1" runat="server"> 
    <ContentTemplate> 
     <asp:Button ID="btnSet" runat="server"></asp:Button> 
     <asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" 
      AutoPostBack="true"> 
     </asp:DropDownList> 
     <asp:DropDownList ID="DropDownList2" runat="server"> 
     </asp:DropDownList> 
    </ContentTemplate> 
</asp:UpdatePanel> 
관련 문제