DropDownList - Is it a bug?

M

Mario Hébert

I had some strange behaviors when i were using the .Net DropDownList. Here's
my control declaration in the aspx page:

<asp:dropdownlist ID="cboModulePriority" runat="server" Width="200">
<asp:ListItem Value="200" Selected="True">Default(200)<asp:ListItem/>
<asp:ListItem Value="400">Custom Generic(400)<asp:ListItem/>
<asp:ListItem Value="600">Generic(600)<asp:ListItem/>
</asp:dropdownlist>

Like shown, the 1st ListItem is marked as selected. If i am in a form, that
i reload from a subsequent call(the page already knows the default values
entered by the user, stored in a DB for example), and in the compiled code i
set the cboModulePriority.SelectedItem or SelectedValue to another index
than the fisrt one(suppose that the user has posted the form before with a
value of 600), when i look to the HTML rendering result, the <Option> tag of
the 1st ListItem is broken... Also, we don't see the select end tag...

<div>
<select name="cboModulePriority" id="cboModulePriority"
style="width:200px;">
<option value="200">Default(200)</option>
<option selected="selected" value="400">Custom Generic(400)</option>
<option </div>...

With this bug, i understood that is better to not set the Selected property
in the aspx page if you will adjust the selected item in the compiled
code....


Mario
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top