Display the text part of a dropdown list

Discussion in 'ASP .Net' started by tfs, Jul 6, 2004.

  1. tfs

    tfs Guest

    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.


    Posted Via Usenet.com Premium Usenet Newsgroup Services
    ----------------------------------------------------------
    ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
    ----------------------------------------------------------
    http://www.usenet.com
    tfs, Jul 6, 2004
    #1
    1. Advertising

  2. 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" <-spam.invalid> wrote in message
    news:40ea86de$...
    > 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.
    >
    >
    > Posted Via Usenet.com Premium Usenet Newsgroup Services
    > ----------------------------------------------------------
    > ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
    > ----------------------------------------------------------
    > http://www.usenet.com
    Chris Darnell, Jul 6, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sgane
    Replies:
    1
    Views:
    675
    Paul Lutus
    Oct 11, 2004
  2. Replies:
    2
    Views:
    494
  3. Paul
    Replies:
    2
    Views:
    498
  4. Siew Yee

    Display items from dropdown list in alphabetical order

    Siew Yee, Jul 21, 2005, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    595
    Yahoo
    Jul 21, 2005
  5. Jack
    Replies:
    8
    Views:
    263
Loading...

Share This Page