question reagrding dropdown list option values

S

Sean

HI There,

I would like to find out the syntax for having option values different from
the ones displayed on the page? In regular HTML the forms are like
<option value=1>New South Wales</option>, how can I acheive this in asp
..net?

Sean

!---

<ASP:DropDownList id=lstRegion name=lstRegion maxlength= "40" runat=server>
<asp:ListItem>New South Wales</asp:ListItem>
<asp:ListItem>Victoria</asp:ListItem>
<asp:ListItem>Tasmania</asp:ListItem>
<asp:ListItem>South Australia</asp:ListItem>
<asp:ListItem>Western Australia</asp:ListItem>
<asp:ListItem>Northern Territory</asp:ListItem>
<asp:ListItem>Queensland</asp:ListItem>
</ASP:DropDownList>
 
K

Ken Cox [Microsoft MVP]

Hi Sean,

You can put the value in as an attribute like this:

<ASP:DropDownList id="lstRegion" name="lstRegion" maxlength="40"
runat="server">
<asp:ListItem Value="NSW">New South Wales</asp:ListItem>
<asp:ListItem Value="V">Victoria</asp:ListItem>
<asp:ListItem Value="T">Tasmania</asp:ListItem>
<asp:ListItem Value="SA">South Australia</asp:ListItem>
<asp:ListItem Value="WA">Western Australia</asp:ListItem>
<asp:ListItem Value="NT">Northern Territory</asp:ListItem>
<asp:ListItem Value="Q">Queensland</asp:ListItem>
</ASP:DropDownList>

Does this help?

Ken
Microsoft MVP [ASP.NET]
Toronto
 
S

Sean

Thanks Ken.


Ken Cox said:
Hi Sean,

You can put the value in as an attribute like this:

<ASP:DropDownList id="lstRegion" name="lstRegion" maxlength="40"
runat="server">
<asp:ListItem Value="NSW">New South Wales</asp:ListItem>
<asp:ListItem Value="V">Victoria</asp:ListItem>
<asp:ListItem Value="T">Tasmania</asp:ListItem>
<asp:ListItem Value="SA">South Australia</asp:ListItem>
<asp:ListItem Value="WA">Western Australia</asp:ListItem>
<asp:ListItem Value="NT">Northern Territory</asp:ListItem>
<asp:ListItem Value="Q">Queensland</asp:ListItem>
</ASP:DropDownList>

Does this help?

Ken
Microsoft MVP [ASP.NET]
Toronto

Sean said:
HI There,

I would like to find out the syntax for having option values different
from
the ones displayed on the page? In regular HTML the forms are like
<option value=1>New South Wales</option>, how can I acheive this in asp
.net?

Sean

!---

<ASP:DropDownList id=lstRegion name=lstRegion maxlength= "40"
runat=server>
<asp:ListItem>New South Wales</asp:ListItem>
<asp:ListItem>Victoria</asp:ListItem>
<asp:ListItem>Tasmania</asp:ListItem>
<asp:ListItem>South Australia</asp:ListItem>
<asp:ListItem>Western Australia</asp:ListItem>
<asp:ListItem>Northern Territory</asp:ListItem>
<asp:ListItem>Queensland</asp:ListItem>
</ASP:DropDownList>
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top