473,408 Members | 2,405 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Why SelectedIndexChanged event for DropDownList sometimes did not fired or beware of the same values in VALUE property

hal
I dont know if this helps anyone but i've just banged my head for the
past two hours with the problem of a dropdownlist in asp.net which
somwtimes did not fired or when it was auto posted back the value and
text propertie of the control was always the value of the first
listitem in the control althought i've selected entirely different
item (before the autopost).

After trying manual population of the dropdown control (without
databinding), placing the breakpoints on every imaginable place on the
page the answer was...well..simple.

The matter is that i've populated dropdown with DIFFERENT TEXT
properties but each text propertie had THE SAME value (eg. text
property was John, value propertie vas me@me.com,text property was
Mary, value propertie vas me@me.com, etc... )

And .net through its divine wisdom obviously always checks only VALUE
propertie on postback (text AND value propertie should be a better
choice or maybe not?) and because ALL values were the same (for
testing reason) this little annoying behaviour occured.

Have a nice day!
Timothy
Nov 18 '05 #1
2 3047
Thanks Timothy, good to know that.

Eliyahu

"hal" <ha***@walla.com> wrote in message
news:10**************************@posting.google.c om...
I dont know if this helps anyone but i've just banged my head for the
past two hours with the problem of a dropdownlist in asp.net which
somwtimes did not fired or when it was auto posted back the value and
text propertie of the control was always the value of the first
listitem in the control althought i've selected entirely different
item (before the autopost).

After trying manual population of the dropdown control (without
databinding), placing the breakpoints on every imaginable place on the
page the answer was...well..simple.

The matter is that i've populated dropdown with DIFFERENT TEXT
properties but each text propertie had THE SAME value (eg. text
property was John, value propertie vas me@me.com,text property was
Mary, value propertie vas me@me.com, etc... )

And .net through its divine wisdom obviously always checks only VALUE
propertie on postback (text AND value propertie should be a better
choice or maybe not?) and because ALL values were the same (for
testing reason) this little annoying behaviour occured.

Have a nice day!
Timothy

Nov 18 '05 #2
Although also checking the text of the submitted item could be helpful, it's
also impossible. When a browser submits a form, it submits a set of
(name,value) pairs for each enabled form element for which it has a value.
So, all the server receives for your list is the name of the list (which
asp.net associates with your control) and the "value" of the selected item.
So, there's no way for asp.net to know which "me@me.com" the user picked.
Unless you've got something very specific in mind, using duplicate "value"
properties for items in a list is a Bad Idea(tm).

"hal" wrote:
I dont know if this helps anyone but i've just banged my head for the
past two hours with the problem of a dropdownlist in asp.net which
somwtimes did not fired or when it was auto posted back the value and
text propertie of the control was always the value of the first
listitem in the control althought i've selected entirely different
item (before the autopost).

After trying manual population of the dropdown control (without
databinding), placing the breakpoints on every imaginable place on the
page the answer was...well..simple.

The matter is that i've populated dropdown with DIFFERENT TEXT
properties but each text propertie had THE SAME value (eg. text
property was John, value propertie vas me@me.com,text property was
Mary, value propertie vas me@me.com, etc... )

And .net through its divine wisdom obviously always checks only VALUE
propertie on postback (text AND value propertie should be a better
choice or maybe not?) and because ALL values were the same (for
testing reason) this little annoying behaviour occured.

Have a nice day!
Timothy

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Donal | last post by:
I have 3 related dropdowns. When the 1st is changed, the 2nd is updated, and when the 2nd is changed, the 3rd is updated. When i change the 1st dropdown (sites), the SelectedIndexChanged fires...
2
by: Dominic | last post by:
Hi guys, I'm not sure if this question belongs to FAQ, but I couldn't find a concrete answer. I created a Datagrid control using ItemTemplate, but it's NOT a in-place editing datagrid. One of...
3
by: DesignerX | last post by:
I have a dynamically created composite server control. The composite control contains a dropdownlist, a validator and a label. I have the dropdownlist AutoPostBack set to true and have defined...
4
by: George | last post by:
I'm using .NET framework 1.1 and VS.NET 2003 for a aspx web form. There is a DropDwonList on the page and its SelectedIndexChanged event is fired to the server normally, until when I add another...
6
by: Scott Lee | last post by:
I am displaying an ASP.Net generated form in a popup opened with window.showModalDialog. The form contains DropDownList controls. The first ddl is populated via databinding to a datatable, has...
0
by: Tand35006 | last post by:
Hi, I hope some one can help with this. I have a basic webform with 2 DropDownLists and a single DataGrid. What I am trying to do is populate the first DDList from a dataset on Form_Load. I then...
2
by: Dave A | last post by:
I am stuggling with databinding a drop down list, hooking into the SelectedIndexChanged and attempting to avoid using the viewstate. The drop down list is quite large so I would prefer to avoid...
3
by: Alec MacLean | last post by:
Hi, I have a couple of win forms where I am editing values that are stored in a SQL database. I'm using the listbox control to hold the data object each form interacts with. Each object is...
11
by: J055 | last post by:
Hi I have a dropdown control which is constructed in another dropdown control SelectedIndexChanged event protected void ddlParamType_SelectedIndexChanged(object sender, EventArgs e) { //...
0
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
0
BarryA
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...
1
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...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.