Persisting Grid settings

7 posts, 0 answers
  1. Gaurav
    Gaurav avatar
    4 posts
    Member since:
    Dec 2010

    Posted 31 May 2011 Link to this post

    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

  2. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 03 Jun 2011 Link to this post

    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.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. BRK
    BRK avatar
    35 posts
    Member since:
    Jun 2012

    Posted 10 Jun 2011 Link to this post

    I used this code for my coding but not working all the events are missing when we click paging
  5. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 13 Jun 2011 Link to this post

    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.

  6. Mohammed
    Mohammed avatar
    87 posts
    Member since:
    Aug 2011

    Posted 22 Oct 2012 Link to this post

    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
  7. Radoslav
    Admin
    Radoslav avatar
    1564 posts

    Posted 25 Oct 2012 Link to this post

    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.
  8. Mohammed
    Mohammed avatar
    87 posts
    Member since:
    Aug 2011

    Posted 25 Oct 2012 Link to this post

    thanks Radoslav,
    Regards,
    Mohammed
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017