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.
精彩评论