I have a composite control that has a DropDownList inside.
The problem i have is the next one: When i load the data on the Page_Load (the first time the page is loaded) everything works fine, but when there is a postback and i want to refresh the datasource (i mean, with a different one), the datasource is saved to the ViewState, but not databinded to the dropdownlist.
I found out that this is happening because the page lifecycle changes from the first time it is rendered to the second time:
- 1st time: Page_Load - CreateChildControls
- 2nd time: CreateChildControls - Page_Load - Function_Called_On_Postback
So my problem is that the i do the databind in the CreateChildControls() but the datasource is setted on the Function_Called_On_Postback(), so, the dropdownlist doesn't get the changes.
Do you know how can i fix this? Do you have at least an advice?
Thanks a lot!