开发者

How to remove the viewstate of a Control programmatically?

开发者 https://www.devze.com 2023-03-13 02:51 出处:网络
I have a control, RadGrid, for which viewstate should stay enabled. Only when a condition is met, a button is clicked, the viewstate开发者_开发技巧 of that control should be removed so that the new v

I have a control, RadGrid, for which viewstate should stay enabled.

Only when a condition is met, a button is clicked, the viewstate开发者_开发技巧 of that control should be removed so that the new values are bound to this control.

How to remove the viewstate of a Control programmatically?

Many thanks,


You can remove an item from ViewState with:

ViewState["controlName"] = null;

However, after this, you will need to recreate the control and re-add it to the page, else your ViewState will not match your control tree.

0

精彩评论

暂无评论...
验证码 换一张
取 消