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. 3 12469
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.
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.
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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Dan |
last post by:
Can anyone offer suggestions on how to do this or if it is possible?
I have a form that uses a drop down box and 2 text fields.
What I am trying to do is have the value of each text box set by...
|
by: Dan |
last post by:
This is one that has me stumped and I need an expert's input.
Any ideas why the values from the second script-generated drop down
list isn't recognized by the script to add time values to the...
|
by: Yoshitha |
last post by:
hi
I have 2 drop down lists in my application.1st list ontains itmes like
java,jsp,swings,vb.net etc.2nd list contains percentage i.e it conatains the
items like 50,60,70,80,90,100.
i will...
|
by: Vigneshwar Pilli via DotNetMonster.com |
last post by:
string connectionString1 = "server=(local); user=sa;password=sa;
database=sonic";
System.Data.SqlClient.SqlConnection dbConnection1 = new
System.Data.SqlClient.SqlConnection(connectionString1);...
|
by: John Walker |
last post by:
Hi,
On an ASP.NET page I have a drop down list control. When the user pulls
down the list and makes a selection, I perform validation, and if the
validation fails I want the selected item in...
|
by: Mike Collins |
last post by:
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.
It was asked by someone else what the autopostback was...
|
by: weiwei |
last post by:
Hi
here is my scenario, I create a drop down list in itemtemplate.(that
drop down is created from db), after user
click edit command, my ideal plan is have another drop down list in...
|
by: penny111 |
last post by:
Hi there,
For my application, i need to have 3 drop down lists
1. drop down list of folder names
2. drop down list of documents in the folder selected
3. drop down list of instances of the...
|
by: abTech |
last post by:
Have struggled a lot to get a filtered drop down in the normal html and that too editable ... i have used table like auto-completion etc ... This is the simplest solution for a filtered drop down
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |