• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 367
  • Last Modified:

How to retrieve row selected from dropdownlist?

Hello,

When I select a row from cmbDonor, the value selected is not registered, for example when I try to see the value selected in a meaasge box with the code below, I get the value of the first row, even when I set the Auto postback property to True.
 MsgBox(CmbDonor.SelectedItem.ToString) Any ideas what I'm doing wrong?

Thanks,

Victor
0
vcharles
Asked:
vcharles
1 Solution
 
AnuTijiCommented:
Hi

Please make sure that the loading of dropdownlist is written inside (if ( !IsPostback)) in the page load method. Else whenever a selection is made, it will load the dropdown contents again and the first item will be shown in the message box.
0
 
Lord_DeathCommented:
AT First are you reBinding the DropDownList in PostBack.

Fill the DDL in !(Page.IsPostBack) and at the end of your Page_Load get CmbDonor.SelectedValue ,

there shouldnt be a problem...
If this didnt help try to post part of your code.
0
 
mr_nadgerCommented:
is the list being reset when you post back due to code in the page load event not checking for postback=true?
0
 
vcharlesAuthor Commented:
Hello,

It worked with setting if ispostbsck = false before
The code to load the object.

Thank you for all your comments.

Victor
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now