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@dotnet.itags.org.me.com,text property was
Mary, value propertie vas me@dotnet.itags.org.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!
TimothyThanks Timothy, good to know that.
Eliyahu
"hal" <hal9k@.walla.com> wrote in message
news:10ef6d8f.0409130018.792b03f3@.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
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
0 comments:
Post a Comment