Results 1 to 5 of 5

Thread: select a specific Item???

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2004
    Location
    cainta
    Posts
    80

    select a specific Item???

    How to select a specific Item in a DropDownList in asp.net?

    using SelectedIndexChanged I can select any items in a DropDownList that i bind in my database but the result gives me the first item always which is the value of index 0 or first item.

    the result should be whatever item that i selected in my DropDownList...
    Last edited by Chowking; Aug 8th, 2005 at 09:58 PM.

  2. #2
    Addicted Member jewel's Avatar
    Join Date
    Jul 2003
    Location
    truly asia
    Posts
    153

    Re: select a specific Item???

    VB Code:
    1. s = lst.Items(lst.SelectedIndex).Text
    xoxo

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2004
    Location
    cainta
    Posts
    80

    Re: select a specific Item???

    When i false my AutoPostBack properties, I can now select any item in my DropDownList.

    How would i post the selected item to my textbox?

    I tried this code in SelectedIndexChanged but it wont work at all.
    "STRinfo.Text = STRinfo.SelectedItem.Value"

  4. #4
    Addicted Member jewel's Avatar
    Join Date
    Jul 2003
    Location
    truly asia
    Posts
    153

    Re: select a specific Item???

    VB Code:
    1. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    2.         Response.Write(drp.Items(drp.SelectedIndex).Text)
    3.         Response.Write(drp.SelectedItem.Text)
    4.     End Sub

    I tried it and it works fine...
    xoxo

  5. #5
    Fanatic Member VBKNIGHT's Avatar
    Join Date
    Oct 2000
    Location
    Port25
    Posts
    619

    Re: select a specific Item???

    it shud be something like this:
    STRinfo.Text = dropdownname.SelectedValue

    If a post has helped you then Please Rate it!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width