help me for a dropdownlist please

Look_here

Newcomer
Joined
Jan 6, 2005
Messages
2
Location
Beijing
I use a dropdownlist control which is bond to a datafield,now I want to get the text in the dropdownlist item which I select,but every time,the text I got is the first item's text,why this and how can I get what I want?
Please.
 
Are you binding the control within the Page_Load event? If so this will rebind the drop down list every page refresh - effectively losing the selected item.
What you need to do is only bind the control on the initial page load, not subsequent ones.
The easiest way to do this is using the Page.IsPostBack property
Visual Basic:
If Page.IsPostBack Then
'Stuff to do on postbacks, not the initial page load
Else
'Stuff to do on the initial page load (databinding etc)
End If

'Stuff to do everytime page is loaded
 
Back
Top