This is a migrated thread and some comments may be shown as answers.

How to Remove The RadGrid ViewState Programmatically?

1 Answer 227 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pooya
Top achievements
Rank 1
Pooya asked on 13 Jun 2011, 01:56 PM
I have a RadGrid control for which ViewState is enabled as it has to be enabled because I'm using DetailTables.

However, there is a button that when is clicked, the existing viewstate information should be removed/deleted so that the new structure can get bound to the RadGrid.

how would it be possible?

Many thanks,

1 Answer, 1 is accepted

Sort by
0
Pooya
Top achievements
Rank 1
answered on 15 Jun 2011, 05:43 PM
after my radgrid was added to the control, I just call the following method and the viewstate gets removed:

        private void DisableViewState()
        {
            // if the button was clicked, disable the viewstate because the RadGrid should be recreated.
            if (Request.Form[this.btnRun.UniqueID] != null)
            {
                this.phDaily.ViewStateMode = ViewStateMode.Disabled;
                this.phDaily.EnableViewState = false;
            }
        }

phDaily is the placeholder name and btnRun is the button control.

It may help someone with a similar issue later!
Tags
Grid
Asked by
Pooya
Top achievements
Rank 1
Answers by
Pooya
Top achievements
Rank 1
Share this question
or