Look_here Posted January 6, 2005 Posted January 6, 2005 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. Quote
Administrators PlausiblyDamp Posted January 6, 2005 Administrators Posted January 6, 2005 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 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 Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.