Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 365
  • 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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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