![]() |
|
|
|
#1 |
|
Hi all,
I have a main ASPX page, and a control ASCX page, there is a Repeater control in ASCX page, and several drop down boxes in main page. These drop down boxes will trigger postback. In the ASCX page, if I put code like private void Page_Load(object sender, System.EventArgs e) { if (! Page.IsPostBack) { Data_Binding(); // to populate values in Repeater } } Everytime when the page posts back because of drop down box selection change, I loose all content in the Repeater. I enabled ViewState in ASCX and Repeater control. If I let page to run Data_Binding() regardless of postback status, then it is fine. In my mind, Viewstate should remember what is for Repeater, I should not need to commnet out the line if (! Page.IsPostBack) to make page to recreate the Repeater everytime. Any idea? Thanks! -- WWW: http://hardywang.1accesshost.com ICQ: 3359839 yours Hardy Hardy Wang |
|
|
|
|
#2 |
|
Posts: n/a
|
The only time I have seen this behavior is when the main page is loading
the control dynamically using LoadControl(). "Hardy Wang" <> wrote in news:: > Hi all, > I have a main ASPX page, and a control ASCX page, there is a > Repeater > control in ASCX page, and several drop down boxes in main page. These > drop down boxes will trigger postback. > In the ASCX page, if I put code like > private void Page_Load(object sender, System.EventArgs e) { > if (! Page.IsPostBack) { > Data_Binding(); // to populate values in Repeater > } > } > Everytime when the page posts back because of drop down box > selection > change, I loose all content in the Repeater. I enabled ViewState in > ASCX and Repeater control. If I let page to run Data_Binding() > regardless of postback status, then it is fine. > In my mind, Viewstate should remember what is for Repeater, I > should not > need to commnet out the line if (! Page.IsPostBack) to make page to > recreate the Repeater everytime. > > Any idea? > > Thanks! > cbDevelopment |
|
![]() |
| Thread Tools | Search this Thread |
|
|