471,350 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

Determining Drop Down List Value

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.
Jan 20 '06 #1
3 12380
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.

"Mike Collins" wrote:
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.

Jan 20 '06 #2
Mike,
do you have the control's AutoPostBack property set to true?
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Mike Collins" wrote:
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.

"Mike Collins" wrote:
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.

Jan 20 '06 #3
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?

"Peter Bromberg [C# MVP]" wrote:
Mike,
do you have the control's AutoPostBack property set to true?
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Mike Collins" wrote:
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.

"Mike Collins" wrote:
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.

Jan 20 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Dan | last post: by
2 posts views Thread by Yoshitha | last post: by
5 posts views Thread by Vigneshwar Pilli via DotNetMonster.com | last post: by
3 posts views Thread by John Walker | last post: by
2 posts views Thread by Mike Collins | last post: by
1 post views Thread by abTech | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.