J
jung_h_park
From: (e-mail address removed)
Newsgroups: microsoft.public.dotnet.framework.aspnet
Subject: Dropdown List not retaining its SelectedValue
Date: Mon, 26 Jun 2006 21:02:57 -0700
Hello,
My dropdown list control does not retain its SelectedValue. Unless I
read the SelectedValue right after the control has been loaded,
populated, and assigned with its original value (and of course that is
the time I absolutely do not need to read it's value) it alwasy returns
"".
I don't think it's a database or database binding issue, because it's
still not working when I tested with unbound dropdown list - the one
that I manually populated with simple integer sequence.
Here's a brief descript of how the application's structured. The main
window / web page creates an instance of this *.ascx class. Just
before the class is loaded in to the browser window, there's another
class that gets loaded first as a page header, where all the common
controls and user interaction pieces are implemented (like buttons and
stuff), and shared by all the *.ascx classes.
Once the head is loaded, all this class does is pretty much to figure
out which User Control to load in, and one of them is my *.ascx User
Control where this problematic dropdown list is in.
It's pretty complicated... well, at least for me. Anyway, the first
method (other than those standard initialization methods such as
PageLoad) in this User Control that gets called by the main class is
the Display method that loads all the data in from the database. My
dropdown list is populated here.
Once user makes a selection on the dropdown list and clicks on Save on
the header, the head class invokes the Save method in the main class,
which in turn calls up the Save method in my User Control. If I look
at the SelectedValue property of my dropdown list within this method
(when it's called), I can see that it has been reset back to "" (and
its selectedIndex has been reverted to 0).
What's weird is that all the other controls, like textboxes and labels,
still retain their values. It's just the dropdown list that gets reset
like this. What is going on????
I also have noticed that if I assign a value to a class variable inside
of the Display method, by the time when I tried to retrieve it in the
Save method, the value of the class variable becomes "undefined". This
makes no sense to me... It almost feels like I am calling methods on
different instacnes of the class, instead of on the same object.
I am very confused. Does this have something to do with one of those
State, Session, Persistance/Non Persistance object thingy that I kept
hearing about? Okay, if that's the case and I am indeed making method
calls on actually different instances of the same class, why am I able
to retrieve the values from some controls, but not this dropdown list?
???
Thank you very much in advance. Any comments and/or feedbacks will be
greatly appreciated.
Newsgroups: microsoft.public.dotnet.framework.aspnet
Subject: Dropdown List not retaining its SelectedValue
Date: Mon, 26 Jun 2006 21:02:57 -0700
Hello,
My dropdown list control does not retain its SelectedValue. Unless I
read the SelectedValue right after the control has been loaded,
populated, and assigned with its original value (and of course that is
the time I absolutely do not need to read it's value) it alwasy returns
"".
I don't think it's a database or database binding issue, because it's
still not working when I tested with unbound dropdown list - the one
that I manually populated with simple integer sequence.
Here's a brief descript of how the application's structured. The main
window / web page creates an instance of this *.ascx class. Just
before the class is loaded in to the browser window, there's another
class that gets loaded first as a page header, where all the common
controls and user interaction pieces are implemented (like buttons and
stuff), and shared by all the *.ascx classes.
Once the head is loaded, all this class does is pretty much to figure
out which User Control to load in, and one of them is my *.ascx User
Control where this problematic dropdown list is in.
It's pretty complicated... well, at least for me. Anyway, the first
method (other than those standard initialization methods such as
PageLoad) in this User Control that gets called by the main class is
the Display method that loads all the data in from the database. My
dropdown list is populated here.
Once user makes a selection on the dropdown list and clicks on Save on
the header, the head class invokes the Save method in the main class,
which in turn calls up the Save method in my User Control. If I look
at the SelectedValue property of my dropdown list within this method
(when it's called), I can see that it has been reset back to "" (and
its selectedIndex has been reverted to 0).
What's weird is that all the other controls, like textboxes and labels,
still retain their values. It's just the dropdown list that gets reset
like this. What is going on????
I also have noticed that if I assign a value to a class variable inside
of the Display method, by the time when I tried to retrieve it in the
Save method, the value of the class variable becomes "undefined". This
makes no sense to me... It almost feels like I am calling methods on
different instacnes of the class, instead of on the same object.
I am very confused. Does this have something to do with one of those
State, Session, Persistance/Non Persistance object thingy that I kept
hearing about? Okay, if that's the case and I am indeed making method
calls on actually different instances of the same class, why am I able
to retrieve the values from some controls, but not this dropdown list?
???
Thank you very much in advance. Any comments and/or feedbacks will be
greatly appreciated.