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

Persisting Grid settings

6 Answers 139 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gaurav
Top achievements
Rank 1
Gaurav asked on 31 May 2011, 09:01 AM
Hi,

I am using RadGrid with Grid persistence classes to maintain Grid settings in a session even after page refreshes.(refer link below).

http://demos.telerik.com/aspnet-ajax/grid/examples/programming/savinggridsettingsonperuserbasis/defaultcs.aspx

Now, I am seeing that Grid persister is not working properly when I am Hiding/Showing Grid columns from Client side.
I am using below C# code on Page load event to maintain Grid Settings.

if (Page.IsPostBack)

            {

                GridSettingsPersister SavePersister = new GridSettingsPersister(this.radGridItem);

                Session["GridSetting"] = SavePersister.SaveSettings();

            }

//Loading the Grid control with the saved persistence setting

            if (Session["GridSetting"] != null)

            {

                GridSettingsPersister LoadPersister = new GridSettingsPersister(this.radGridItem);

                string settings = (string)Session["GridSetting"];

                LoadPersister.LoadSettings(settings);

            }

Below are my grid settings:
<telerik:radgrid id="radGridItem" allowpaging="True" runat="server" allowmultirowselection="true"

 

 

 

autogeneratecolumns="False" pagesize="20" allowsorting="True" gridlines="Horizontal"

 

 

 

 

onitemcommand="RadGridItem_ItemCommand" onitemdatabound="RadGridItem_ItemDataBound"

 

 

 

 

onneeddatasource="RadGridItem_NeedDataSource" onprerender="RadGridItem_PreRender">

 

 

 

 

<pagerstyle mode="NextPrevAndNumeric" position="Bottom" alwaysvisible="true" pagesizelabeltext="Size:"

 

 

 

 

showpagertext="True" />

 

 

 

 

<mastertableview tablelayout="Fixed" width="100%" canretrievealldata="false" autogeneratecolumns="False"

 

 

 

 

retrievealldatafields="false" allowmulticolumnsorting="false">

 

 

 

 

<Columns>

 

 

 

 

</Columns>

 

 

 

 

 

</mastertableview>

 

 

 

 

<clientsettings>

 

 

 

 

<Selecting AllowRowSelect="True" EnableDragToSelectRows="false" />

 

 

 

 

<ClientEvents OnGridCreated="gridCreated" />

 

 

 

 

<Resizing AllowColumnResize="true" ClipCellContentOnResize="false" ResizeGridOnColumnResize="false"

 

 

 

 

EnableRealTimeResize="true" />

 

 

 

 

</clientsettings>

 

 

 

 

<groupingsettings casesensitive="false" />

 

 

 

 

</telerik:radgrid>

 

 

 

 

 

Please let me know if require any other details from my side.

Thanks in advance
Gaurav Jain

6 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 03 Jun 2011, 08:10 AM
Hello Gaurav,

I assume that the cause of the issue is that you do not rebind the grid after loading the settings.

Please try the following code and let me know whether it helps:
if (Page.IsPostBack)
{
    GridSettingsPersister SavePersister = new GridSettingsPersister(this.radGridItem);
    Session["GridSetting"] = SavePersister.SaveSettings();
}
 
//Loading the Grid control with the saved persistence setting
if (Session["GridSetting"] != null)
{
    GridSettingsPersister LoadPersister = new GridSettingsPersister(this.radGridItem);
    string settings = (string)Session["GridSetting"];
    LoadPersister.LoadSettings(settings);
    radGridItem.Rebind();
}

Kind regards,
Mira
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
BRK
Top achievements
Rank 1
answered on 10 Jun 2011, 07:52 AM
I used this code for my coding but not working all the events are missing when we click paging
0
Mira
Telerik team
answered on 13 Jun 2011, 11:31 AM
Hello,

Based on the supplied information, it is hard to determine what is causing the issue.
Please open a formal support ticket and send us a small working project, demonstrating your full setup and showing the unwanted behavior.
We will debug it locally and get back to you.

Thank you in advance for the cooperation.

Regards,
Mira
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Mohammed
Top achievements
Rank 2
answered on 23 Oct 2012, 01:56 AM
Hi team,
how we can reset the grid setting to the default after loading the saved settings.
we want to have a "Reset" column which return the grid to the default settings.
Regards.
Mohammed
0
Radoslav
Telerik team
answered on 25 Oct 2012, 10:21 AM
Hi Mohammed,

To achieve the desired functionality you could try saving the initially loaded state of the RadGrid via GridSettingsPersister and when the grid needs to be reset to load this initial state. Please give it try and let me know if it helps you.

Looking forward for your reply.

Kind regards,
Radoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Mohammed
Top achievements
Rank 2
answered on 25 Oct 2012, 10:54 AM
thanks Radoslav,
Regards,
Mohammed
Tags
Grid
Asked by
Gaurav
Top achievements
Rank 1
Answers by
Mira
Telerik team
BRK
Top achievements
Rank 1
Mohammed
Top achievements
Rank 2
Radoslav
Telerik team
Share this question
or