Note that there are some explanatory texts on larger screens.

plurals
  1. POAutoPostBack="true" doesn't work for DropDownList with DataSource
    primarykey
    data
    text
    <p>I have following *.aspx page</p> <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Admin_Test" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt; &lt;head id="Head1" runat="server"&gt; &lt;title&gt;Untitled Page&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form2" runat="server"&gt; &lt;div&gt; &lt;asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataTextField="Name" DataValueField="FieldKey" /&gt; &lt;asp:Label ID="Label1" runat="server" Text="Label"&gt;&lt;/asp:Label&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>and *.aspx.cs page</p> <pre><code>using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Collections.Generic; using System.Linq; public partial class Admin_Test : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataClassesDataContext datacontext = new DataClassesDataContext(); DropDownList1.DataSource = datacontext.GetAllDepartments(false); DropDownList1.DataBind(); } } } </code></pre> <p>When I change the value in dropdownList (in browser), it does PostBack, but it selects the first item of list after PostBack - it doesn't save my value.</p> <p>GetAllDepartments(isDeleted) is a stored procedure, it returns a List of objects with two properties - FieldKey and Name.</p>
    singulars
    1. This table or related slice is empty.
    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