Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.NET AJAX Doesnt Work
    primarykey
    data
    text
    <p>I have a very simple AJAX example that doesn't work. It is from the Microsoft tutorials on AJAX.</p> <p>When I click on button "Button1" AJAX should execute but the whole page submits.</p> <p>Here is the code:</p> <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="1111.aspx.cs" Inherits="_1111" %&gt; &lt;%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;p&gt; DropDownList AutoPostBack SelectedIndexChanged EventArgs Sort ... Since you will be using AJAX to process your SelectedIndexChanged event, set the AutoPostBack property of the DropDownList to false. ...&lt;/p&gt; &lt;div&gt; &lt;asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"&gt; &lt;/asp:ScriptManager&gt; &lt;asp:Label ID="label2" runat="server"&gt;&lt;/asp:Label&gt;&lt;br /&gt; &lt;asp:Label ID="label3" runat="server"&gt;&lt;/asp:Label&gt;&lt;br /&gt; &lt;center&gt; &lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&gt; &lt;ContentTemplate&gt; &lt;asp:Label ID="label1" runat="server"&gt;&lt;/asp:Label&gt; &lt;asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button 1" /&gt; &lt;/ContentTemplate&gt; &lt;Triggers&gt; &lt;asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" /&gt; &lt;/Triggers&gt; &lt;/asp:UpdatePanel&gt; &lt;/center&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Code-behind: </p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _1111 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { label1.Text = System.DateTime.Now.ToString(); label2.Text = System.DateTime.Now.ToString(); label3.Text = System.DateTime.Now.ToString(); } protected void Button1_Click(object sender, EventArgs e) { label1.Text = System.DateTime.Now.ToString(); } } </code></pre>
    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