2010-01-19 5 views
3

UpdatePanels에 관해서는 별도로 무효화해야합니다. 즉, 하나의 UpdatePanel을 트리거하면 다른 패널의 컨트롤을 터치하지 않아야합니다. 그것은 그러나 어떤 UpdatePanel 안에있는 사람들은 어떤 UpdatePanel 트리거 영향을받는 모든 UpdatePanels의 외부 컨트롤에 대한 있도록 작업을 수행합니다 뒤에어떻게 독립적 인 업데이트 패널을 만들 수 있습니까?

<form id="form1" runat="server"> 
<asp:ScriptManager ID="SM1" runat="server"/> 
<div> 
    <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox> 
    <asp:UpdatePanel ID="update1" runat="server"> 
     <ContentTemplate> 
      <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> 
      <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" /> 
     </ContentTemplate> 
    </asp:UpdatePanel> 
    <asp:UpdatePanel ID="update2" runat="server"> 
     <ContentTemplate> 
      <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> 
      <asp:Button ID="Button2" runat="server" Text="Button" onclick="Button2_Click" /> 
     </ContentTemplate> 
    </asp:UpdatePanel> 
</div> 
</form> 

코드 :

 protected void Page_Load(object sender, EventArgs e) 
    { 

    } 

    protected void Button1_Click(object sender, EventArgs e) 
    { 
     TextBox1.Text = "Clicked 1"; 
     TextBox2.Text = "Shouldn't appear"; 
     TextBox3.Text = "Neither should this"; 
    } 

    protected void Button2_Click(object sender, EventArgs e) 
    { 
     TextBox2.Text = "Clicked 2"; 
     TextBox1.Text = "Shouldn't appear"; 
     TextBox3.Text = "Neither should this"; 
    } 

"어느 쪽이해야한다"표시하지 않습니다 그러나 "나타나지 않아야합니다"가 나타납니다 :(. 아무도 나에게이 문제의 원인을 이해하는 데 도움이 수 있습니까?

답변

3

을 지금 내가 UpdatePanels에 UpdateMode를 = "조건"속성을 넣어 깜빡를 참조하십시오.

작업 코드 :

<form id="form1" runat="server"> 
<asp:ScriptManager ID="SM1" runat="server"/> 
<div> 
    <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox> 
    <asp:UpdatePanel ID="update1" runat="server" UpdateMode="Conditional"> 
     <ContentTemplate> 
      <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> 
      <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" /> 
     </ContentTemplate> 
    </asp:UpdatePanel> 
    <asp:UpdatePanel ID="update2" runat="server" UpdateMode="Conditional"> 
     <ContentTemplate> 
      <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> 
      <asp:Button ID="Button2" runat="server" Text="Button" onclick="Button2_Click" /> 
     </ContentTemplate> 
    </asp:UpdatePanel> 
</div> 
</form> 
+0

예. 예. 실제로 이것은 기본 설정 이었지만 슬프게도 그렇지 않았습니다. – RichardOD

+0

확실히 - 결국이 기능을 구현하는 것은 UpdatePanel을 사용하는 감각입니다. – Aaalf

관련 문제