CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2003
    Location
    RSA
    Posts
    16

    DropDownList Problem

    I am experiencing a problem with a dropdownlist box.

    The list box has been bound to a dataset to call its information from a database.
    It presents all the information in the dropdown from the selected table.

    When I click the button that I have created I run the code:

    Dim strCatagory As String = ddlCatOption.SelectedItem.Value
    lblTest.Text = strCatagory

    Now the problem,
    Whenever I run this it present the first item in the drop down list to me as the strCatagory, irrespective if I selected the 2nd, third or foutth item in the list.

    I hope you can help.

    Thanks

  2. #2
    Join Date
    May 2002
    Location
    India
    Posts
    143
    Check if you are filling the dropdown every time the page got submitted...
    I guess the dropdown is filling again when you press the button..
    If it is then execute that code only when 'Page.isPostBack' is 'false'
    Anupam.

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

Featured