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

Cannot keep settings of RadGrid

4 Answers 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ysea
Top achievements
Rank 1
ysea asked on 20 Dec 2009, 03:28 AM
My situation :
My Web Page has many Tab (dynamic tabs) and 1 RadGrid (grid).  When I changed position tab, grid auto generate dynamic columns.
(I must set property grid.MasterTableView.EnableViewState = false to create dynamic columns). But I can't keep settings of gird when changed to another page and move back

My code :
<code>
private int tabIndex = 0;       // variable to define tab is selected
protected void Page_Init(....)
{
          if(! string.IsNullOrEmpty(Request.QueryString["tabIndex"] )
          {
                    tabIndex = Convert.ToInt32(Request.QueryString["tabIndex"]);
          }
          else
                   tabIndex = 0;
         
          // This method create grid corresponding tab is selected
          CreateGrid(tabIndex);
}

protected void OnUnload(....)
{
       GridPersistSetting gridSetting = new GridPersistSetting (grid);
       Session["grid" + tabIndex] = gridSetting.SaveSettings();
}

protected voi Page_Load(....)
{
        if (!IsPostBack)
        {
                  ....................
                  if(Session["grid" + tablndex] !=null)
                  {
                              GridPersistSetting gridSetting = new GridPersistSetting (grid);
                              gridSetting.LoadSettings(Session["grid" + tabIndex].ToString());
                  }
        }
}

protected void Tab_Click(...)
{
         Response.Redirect("Demo.aspx?tabIndex = " + e.tabIndex)
}
</code>

I do same as your example (gridSetting.LoadSettings() in Page_Init() and and gridSetting.SaveSettings in Render()) but it not success so I must changed as above (on PageLoad and UnLoad)
Can you give me a solution ?
Thanks you.

4 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 21 Dec 2009, 10:08 AM
Hello,

Please review the following help topic which elaborates on this matter. Test the provided approach and let us know if this helps.

Greetings,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
ysea
Top achievements
Rank 1
answered on 21 Dec 2009, 04:09 PM
Thanks for your reply
I've examined this topic but it cannot help me solve my problem.
My problem is grid.MasterTableView.EnableViewState = false so when method SaveSettings() cannot get settings value changes.
0
Pavlina
Telerik team
answered on 22 Dec 2009, 05:10 PM
Hi Phi,

The NextPrevAndNumeric grid pager type requires the viewstate of the control to be enabled.  If you are using this pager type a possible solution for your case would be to store the grid viewstate in the Session (after it is enabled) as explained in this documentation topic.

Greetings,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
ysea
Top achievements
Rank 1
answered on 23 Dec 2009, 03:59 AM
I've seen "Saving the grid ViewState in Session" and I found value of ViewState is keep on PageStatePersiste but still EnableViewState = true
Tags
Grid
Asked by
ysea
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
ysea
Top achievements
Rank 1
Share this question
or