Note that there are some explanatory texts on larger screens.

plurals
  1. POASP Dropdown list with options set to false
    primarykey
    data
    text
    <p>I have a dropdownlist of the form:</p> <pre><code> &lt;asp:DropDownList runat="server" CssClass="holdTypeDDL" ID="holdTypeDDL"&gt;&lt;/asp:DropDownList&gt; </code></pre> <p>and is filled onload in c# codebehind of an aspx page when !Page.isPostback via :</p> <pre><code> holdTypeDDL.Items.Add(new ListItem(string.Empty, false.ToString())); holdTypeDDL.Items.Add(new ListItem(HoldTypeType.Now.Description(), false.ToString())); holdTypeDDL.Items.Add(new ListItem(HoldTypeType.AAHoldType.Description(), true.ToString())); holdTypeDDL.Items.Add(new ListItem(HoldTypeType.AAAHoldType.Description(), true.ToString())); holdTypeDDL.Items.Add(new ListItem(HoldTypeType.AAAAHoldType.Description(), false.ToString())); </code></pre> <p>I have noticed if one of the options of the select are selected that have a string value of False, it does not consider it selected. I.e. the selected index is 0 after postback. If an item with true is selected and value grabbed on postback, it works fine.</p> <p>I cannot find any documentation as to why this is. Why does having a "False" string in the value of an option element make it not post back properly?</p> <p>EDIT:</p> <p>Renders in HTML as such:</p> <pre><code>&lt;select class="holdTypeDDL" id="BodyContent_holdTypeDDL" name="ctl00$BodyContent$holdTypeDDL"&gt; &lt;option value="False"&gt;&lt;/option&gt; &lt;option value="False"&gt;Now&lt;/option&gt; &lt;option value="True"&gt;AA Hold Type&lt;/option&gt; &lt;option value="True"&gt;AAA Hold Type&lt;/option&gt; &lt;option value="False"&gt;AAAA Hold Type&lt;/option&gt; &lt;/select&gt; </code></pre>
    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