Viewstate is setting control values incorrectly.

Posted by Praesagus on Stack Overflow See other posts from Stack Overflow or by Praesagus
Published on 2010-04-26T22:56:18Z Indexed on 2010/05/01 0:27 UTC
Read the original article Hit count: 606

I have a page with several checkboxes on it. The checkboxes correlate to user permissions so when I change users and the page refreshes, the values of the checkboxes should change since each user is different. In spite of the fact that my code sets the value of the checkbox, viewstate or whatever changes the values to what the previous user's values were.

I tried chk.EnableViewState = false; but that did not help. I set EnableViewState="false" EnableViewStateMac="false" EnableEventValidation="false" in the page directives, but that doesn't help. The only way I have been able to fix this is to add a unique value to the controls so that their names are always different. I am sure it's an issue of ignorance.

Thank you for your help.


There is no databinding per se. When the page loads I am creating the textboxes and setting their values via code.

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET