Dropdownlist

egdotnet

Regular
Joined
May 16, 2004
Messages
50
I have an ASP.NET app with a dropdownlist in a web user control, which at runtime, is populated with numbers counting from 1 based on the number of entries in an xml list. i'm trying to let the user select an entry from that list, but when pressing the submit button, the selected entry is not use, but rather, it defaults to 0. how do i make the program accept that selection?

thanks,
eric
 
egdotnet said:
i tried using: dropdownlist3.selectedindex

That will return the index of the selected item which I dont think is what your looking for. use dropdownlist3.selectedvalue to get the underlying value of the listitem or dropdownlist3.selecteditem.text to get the actual text seen by the user.

Also if selectedindex is returning 0 you probably dont have code like
If Not Page.IsPostBack Then
' insert call to function/sub that loads your page here
End If

in your page_load event.
 
the problem with the postback is that since i'm in a web user control, it reoloads the page, with the web user control closed and reset. That undoes everything that I'm trying to do with the menu.
 
Back
Top