J
Jose Fernandez
Hello
First of all, excuse my english
We all know that in a normal page with codebehind we add a dropdownlist
control and we bind() it in the (!ISPOSTBACK), so, we don't need to go to
database again 'cause its value are saved (i assume viewstate).
Well. I have a class that inherits from WebControl and INamingContainer.
This class Load an ASCX control (that contains other controls in itself like
textbox and Dropdownlist). In the CreateChildControls i add the ascx and
initialize its inner controls (by FindControl method). So, i override the
DataBind() and if it's not postback, then i bind() the dropdownlist. this
works right, BUT if there is any postback, it doesn't load its
values(listItems) . The textbox keeps its value. I have been reading that
some people override LoadViewState and SaveViewState in order to persits
Attributes inside the listItems. Is there anything i can do to make my
dropdownlist persists its values so i don't have to load from database
everytime there is a postback?
Can anybody help me on this?
Thanks in advance
Ahora. mi problema es el siguiente. Tengo una clase que hereda de WebControl
y INamingContainer donde agrego aleatoriamente un ascx que quiera mostrar.
El problema es que despues que agrego el control ascx (en el
CreateChildControls) y le inicializo sus controles internos (como textbox,
dropdown, etc.).
hago un override del metodo DataBind y alli le paso el datasource que es un
arraylist que saco de una base de datos si NO ES POSTBACK. El tema es que
cuando hay un postback de nuevo en mi pagina, el textbox mantiene su valor
pero el dropdown me sale completamente vacio. Pierde sus valors. hay algo
que estoy haciendo mal? Se que haciendo overrides del LoadViewState y
SaveViewState se resuelve. Lo he leido. pero no he podido hacerlo funcionar.
Alguien tiene idea?
Ayuda Por Favor. estoy vuelto loco con esto.
First of all, excuse my english
We all know that in a normal page with codebehind we add a dropdownlist
control and we bind() it in the (!ISPOSTBACK), so, we don't need to go to
database again 'cause its value are saved (i assume viewstate).
Well. I have a class that inherits from WebControl and INamingContainer.
This class Load an ASCX control (that contains other controls in itself like
textbox and Dropdownlist). In the CreateChildControls i add the ascx and
initialize its inner controls (by FindControl method). So, i override the
DataBind() and if it's not postback, then i bind() the dropdownlist. this
works right, BUT if there is any postback, it doesn't load its
values(listItems) . The textbox keeps its value. I have been reading that
some people override LoadViewState and SaveViewState in order to persits
Attributes inside the listItems. Is there anything i can do to make my
dropdownlist persists its values so i don't have to load from database
everytime there is a postback?
Can anybody help me on this?
Thanks in advance
Ahora. mi problema es el siguiente. Tengo una clase que hereda de WebControl
y INamingContainer donde agrego aleatoriamente un ascx que quiera mostrar.
El problema es que despues que agrego el control ascx (en el
CreateChildControls) y le inicializo sus controles internos (como textbox,
dropdown, etc.).
hago un override del metodo DataBind y alli le paso el datasource que es un
arraylist que saco de una base de datos si NO ES POSTBACK. El tema es que
cuando hay un postback de nuevo en mi pagina, el textbox mantiene su valor
pero el dropdown me sale completamente vacio. Pierde sus valors. hay algo
que estoy haciendo mal? Se que haciendo overrides del LoadViewState y
SaveViewState se resuelve. Lo he leido. pero no he podido hacerlo funcionar.
Alguien tiene idea?
Ayuda Por Favor. estoy vuelto loco con esto.