Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

  • Administrators
Posted

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

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...