Determining Drop Down List Value

G

Guest

I'm not feeling too smart right now, but I cannot get the correct drop down
list value from a drop down I have on my web form. I get the initial value
that was loaded in the list. Can someone show me what I am doing wrong and
tell me the correct way? Thank you.

In the page load event, I am doing the following:

//Code I use to populate the dropdown list.
ddAssignedTo.DataValueField = "PersonnelID";
ddAssignedTo.DataTextField = "DisplayName";
ddAssignedTo.DataSource = Personnel.List();
ddAssignedTo.DataBind();

//Code I use to show the value from the database.
ddAssignedTo.SelectedValue = problem.AddedBy.PersonnelId.ToString();

When I change the drop down to another item in the list, and click my update
button, I get the previous value that was selected on page load.

//Code I use for that is:
ddAssignedTo.SelectedValue

What am I doing wrong...thank you.
 
G

Guest

Also, I double clicked the control so I could see the selected index change
event fire, but it does not fire. I checked and InitializeComponent has the
event in it, but I don't see why that is not running when I select a
different value. Any thoughts on that? Thanks again.
 
G

Guest

Sorry it took so long for the reply...I got called away on another project
for a little. Anyway, the AutoPostBack property was set to False. I'm
guessing that it should be set to True?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top