Display the text part of a dropdown list

T

tfs

I have a dropdownlist:

<asp:dropdownlist id="recurrance" runat="server">
<asp:listitem value="0" >None</asp:listitem>
<asp:listitem value="1" >Daily</asp:listitem>
<asp:listitem value="2" >Weekly</asp:listitem>
<asp:listitem value="3" >Monthly</asp:listitem>
<asp:listitem value="4" >Yearly</asp:listitem>
</asp:dropdownlist>


I have these stored as the values.

How do I easily display the text portion on my web page (not the
value), so that if I have a value of "3" that I got from my Sql
database, I will display "Monthly". I also want it to display on one
page as the the dropdown and on another page as only text, with no
borders.

Thanks,

Tom.
 
C

Chris Darnell

I believe that the SelectedItem property will provide you with what you are
looking for.

http://msdn.microsoft.com/library/d...controlslistcontrolclassselecteditemtopic.asp

--
------------------------
Chris Darnell
Homepage: http://www.darnellc.com
Weblog: http://journals.aol.com/csdarnell/ChrisDarnellsBlog


tfs said:
I have a dropdownlist:

<asp:dropdownlist id="recurrance" runat="server">
<asp:listitem value="0" >None</asp:listitem>
<asp:listitem value="1" >Daily</asp:listitem>
<asp:listitem value="2" >Weekly</asp:listitem>
<asp:listitem value="3" >Monthly</asp:listitem>
<asp:listitem value="4" >Yearly</asp:listitem>
</asp:dropdownlist>


I have these stored as the values.

How do I easily display the text portion on my web page (not the
value), so that if I have a value of "3" that I got from my Sql
database, I will display "Monthly". I also want it to display on one
page as the the dropdown and on another page as only text, with no
borders.

Thanks,

Tom.
 

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