Note that there are some explanatory texts on larger screens.

plurals
  1. POChanging dropdownlist selection causes full postback. (it's more interesting than it sounds)
    text
    copied!<p>Here's the scenario.</p> <p>I have a search page with a TextBox that allows someone to type in a search term and press enter. (Which fires TextChanged). I have a DropDownList that specifies the kind of search that will be performed. It is defined in the markup as follows:</p> <pre><code> &lt;asp:DropDownList ID="lstSearchType" runat="server" AutoPostBack="false"&gt; &lt;asp:ListItem Value="0"&gt;Last, First&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="1"&gt;Last&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="2"&gt;First&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="3"&gt;Liberty ID&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="4"&gt;E-mail&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="5"&gt;Telephone&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="6"&gt;Birthday (exact m/d/yyyy)&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="7"&gt;SSN (exact ###-##-####)&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="8"&gt;Address&lt;/asp:ListItem&gt; &lt;/asp:DropDownList&gt; </code></pre> <p>As you can see, AutoPostBack is set to false, and there is no event hookup.</p> <p>Pressing enter fires the OnTextChanged event for the TextBox, which performs a search and updates a GridView in an UpdatePanel. This UpdatePanel has its UpdateMode set to conditional and has one trigger: the TextChanged event of the search TextBox. </p> <p>It's very simple. </p> <p>And it works beautifully, almost. </p> <p>Whenever I change the search type, the very next search does a full postback. All subsequent searches do partial postbacks (as desired) unless I change the search type again. </p> <p>There is one exception to this rule: if I load the page and immediately change the search type, it doesn't do a full postback. So the first change of the DropDownList before any postback (full or partial) does not trigger a full postback. </p> <p>Full Disclosure: I'm doing a lot of JavaScript to change the appearance of the gridview during async requests. I don't detail it here because it seems unrelated. This problem only occurs when a DropDownList with no JavaScript wired up is changed. </p> <p>Any ideas? </p> <p>This is driving me crazy. Everything else is working.</p> <p>Thanks in advance, Clif</p>
 

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