Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You could put the DropDownList inside an UpdatePanel and then subscribe to the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listcontrol.selectedindexchanged.aspx" rel="nofollow">SelectedIndexChanged</a> event after setting the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listcontrol.autopostback.aspx" rel="nofollow">AutoPostBack</a> property to <code>true</code>.</p> <p>Here's an example:</p> <pre><code>&lt;%@ Page Language="C#" %&gt; &lt;script type="text/C#" runat="server"&gt; protected void OnChange(object sender, EventArgs e) { label.Text = string.Format("Selected value: {0}", ddl.SelectedValue); } &lt;/script&gt; &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="Form1" runat="server"&gt; &lt;asp:ScriptManager ID="scm" runat="server" /&gt; &lt;asp:UpdatePanel ID="up" runat="server"&gt; &lt;ContentTemplate&gt; &lt;asp:DropDownList ID="ddl" runat="server" AutoPostBack="true" OnSelectedIndexChanged="OnChange"&gt; &lt;asp:ListItem Value="1" Text="item 1" /&gt; &lt;asp:ListItem Value="2" Text="item 2" /&gt; &lt;asp:ListItem Value="3" Text="item 3" /&gt; &lt;/asp:DropDownList&gt; &lt;asp:Label ID="label" runat="server" /&gt; &lt;/ContentTemplate&gt; &lt;Triggers&gt; &lt;asp:AsyncPostBackTrigger ControlID="ddl" EventName="SelectedIndexChanged" /&gt; &lt;/Triggers&gt; &lt;/asp:UpdatePanel&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>To learn more about update panels and ASP.NET AJAX you may take a look at the <a href="http://www.asp.net/ajax/documentation/live/overview/UpdatePanelOverview.aspx" rel="nofollow">following article</a>.</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.
 

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