![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a imagebutton in a detailsview, which, when clicked, causes postback and show or hide some of the rows. (Me.DetailsView1.Fields(4).Visible = true or false) That's all it does. In the same detailsview I have other controls : dropdownlist, checkbox and textboxes etc., all of them are bound to database fields when page is loaded. When I changed the values in the dropdownlist/checkbox/textbox, and then click the imagebutton to show/hide some other rows, all the changes I made to the dropdownlist/checkbox/textbox are gone (restored to its original bound value) after postback. I commented the code that does the show/hide of rows, and found that the values of dropdownlist/checkbox/textbox are preserved after postback. So I wonder if this is normal -- when a row in a detailsview is dynamically made shown or hidden, then the whole detailsview will have to be databound again, causing all controls inside this detailsview to retored its original bound value. Thanks. |
#3
| |||
| |||
|
|
I just found a workaround: I had to save the updated information in ViewState, and then during postback, assign the controls with the values saved in ViewState. "News User" <newsuser (AT) newsuser (DOT) com> wrote in message news:ONSrFHLtGHA.1512 (AT) TK2MSFTNGP03 (DOT) phx.gbl... I have a imagebutton in a detailsview, which, when clicked, causes postback and show or hide some of the rows. (Me.DetailsView1.Fields(4).Visible = true or false) That's all it does. In the same detailsview I have other controls : dropdownlist, checkbox and textboxes etc., all of them are bound to database fields when page is loaded. When I changed the values in the dropdownlist/checkbox/textbox, and then click the imagebutton to show/hide some other rows, all the changes I made to the dropdownlist/checkbox/textbox are gone (restored to its original bound value) after postback. I commented the code that does the show/hide of rows, and found that the values of dropdownlist/checkbox/textbox are preserved after postback. So I wonder if this is normal -- when a row in a detailsview is dynamically made shown or hidden, then the whole detailsview will have to be databound again, causing all controls inside this detailsview to retored its original bound value. Thanks. |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |