开发者

How to remove the viewstate of a Control programmatically?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜