Solved

How to retrieve row selected from dropdownlist?

Posted on 2011-09-15
4
356 Views
Last Modified: 2012-06-27
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
Comment
Question by:vcharles
4 Comments
 
LVL 4

Accepted Solution

by:
AnuTiji earned 500 total points
ID: 36547541
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
 
LVL 2

Expert Comment

by:Lord_Death
ID: 36547543
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
 
LVL 7

Expert Comment

by:mr_nadger
ID: 36547781
is the list being reset when you post back due to code in the page load event not checking for postback=true?
0
 

Author Comment

by:vcharles
ID: 36548168
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now