As far as I understand UpdatePanels, they should be void separately, i.e. The trigger of one UpdatePanel should not touch the controls of another panel. It really works for controls outside of any UpdatePanels, however those that are inside ANY UpdatePanel are affected by running any ANY UpdatePanel:
<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>
Code behind:
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";
}
"Nothing should appear, but" Should not appear "appears :( Can someone help me understand what causes this behavior?
Aaalf source
share