Note that there are some explanatory texts on larger screens.

plurals
  1. POBoth Updatepanel's getting update, while only 1 have to work
    primarykey
    data
    text
    <p>Simple Ajax program needs to update single update panel on a button click does both. Here is the updated code,</p> <pre><code> &lt;asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" ChildrenAsTriggers="false" runat="server"&gt; &lt;ContentTemplate&gt; &lt;fieldset style="width: 30%"&gt; &lt;legend&gt;Panel - 1 &lt;/legend&gt; &lt;asp:Label ID="label1" runat="server"&gt;&lt;/asp:Label&gt; &lt;asp:Button ID="b1" runat="server" OnClick="both" Text="Update Both Pannels" /&gt; &lt;asp:Button ID="b2" runat="server" OnClick="one" Text="Update Single Pannel" /&gt; &lt;/fieldset&gt; &lt;/ContentTemplate&gt; &lt;Triggers&gt; &lt;asp:AsyncPostBackTrigger ControlID="b1" EventName="Click" /&gt; &lt;/Triggers&gt; &lt;/asp:UpdatePanel&gt; &lt;asp:UpdatePanel ID="UpdatePanel2" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional"&gt; &lt;ContentTemplate&gt; &lt;fieldset style="width: 30%"&gt; &lt;legend&gt;Panel - 2 &lt;/legend&gt; &lt;asp:Label ID="label2" runat="server"&gt;&lt;/asp:Label&gt; &lt;/fieldset&gt; &lt;/ContentTemplate&gt; &lt;Triggers&gt; &lt;asp:AsyncPostBackTrigger ControlID="b2" EventName="Click" /&gt; &lt;/Triggers&gt; &lt;/asp:UpdatePanel&gt; </code></pre> <p>Button Click events are as follows,</p> <pre><code>protected void both(object sender, EventArgs e) { label1.Text = DateTime.Now.ToLongTimeString(); label2.Text = DateTime.Now.ToLongTimeString(); UpdatePanel2.Update(); } protected void one(object sender, EventArgs e) { label1.Text = DateTime.Now.ToLongTimeString(); label2.Text = DateTime.Now.ToLongTimeString(); UpdatePanel2.Update(); } </code></pre> <p>The output remains same..Thanks in advance...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload