Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
354 views

The RadGrid's AutoGenerateColumn is set to True. it can generate columns from the data source and load perfectly fine. Then I save the Grid Setting using the PersistanceManager. All good so far

The Grids data-source is actually taken from a View in database. only if I remove a column from the database View, and then try to load the grid along with saved settings then it fails because now the column that was there when saving settings no longer exists in datasource.

Here is how first settings are loaded 

RadPersistenceManagerCs.LoadState()

and then

RadGridCs.Rebind()

The error is thrown in .Rebind()

 


The RadPersistanceManager does not expose any property where i can see what was loaded

I wonder if it is possible to verify if columns in saved settings match columns in data-source some other way

 

Thanks

Harshad

Doncho
Telerik team
 answered on 18 Jul 2023
2 answers
78 views

Hi

I have a inherited class of RadTreeView with TreeNodeExpandMode set on ServerSideCallBack.

I will save the RadTreeView's expanded nodes using RadPersistenceManager. 

01.<telerik:RadPersistenceManager ID="RadPersistenceManager" runat="server">
02.</telerik:RadPersistenceManager>
03. 
04.<mwc:RadTreeView ID="rtvStruttura" runat="server" BorderColor="Gray" Skin="WebBlue"
05.                OnClientNodeExpanded="metTreeClientNodeExpanded" OnClientNodeCollapsed="metTreeClientNodeExpanded" OnNodeExpand="metPopulateNodeOnDemandWrapper"
06.                OnClientContextMenuShowing="rtvContextMenu_OnClientContextMenuShowing" OnClientContextMenuItemClicked="rtvContextMenu_OnClientContextMenuItemClicking">
07.                <ContextMenus>
08.                    <mwc:RadTreeViewContextMenu ID="rtvContextMenu" runat="server" ExpandAnimation-Type="None" CollapseAnimation-Type="None">
09.                        <Items>
10.                            <mwc:RadMenuItem Value="1" LabelResources="VaiAllaScheda_si" />
11.                            <mwc:RadMenuItem IsSeparator="true" />
12.                            <mwc:RadMenuItem Value="2" LabelResources="TitoloNuovaRichiestaIntervento_si" />
13.                        </Items>
14.                    </mwc:RadTreeViewContextMenu>
15.                </ContextMenus>
16.            </mwc:RadTreeView>

 

I set ControlID on RadPersistenceManager at server side

RadPersistenceManager.StorageProvider = new CookieStorageProvider(GetPersistenceManagerKey());
PersistenceSetting vPersistenceTree = new PersistenceSetting();
vPersistenceTree.ControlInstance = (System.Web.UI.Control)((Telerik.Web.UI.RadTreeView)FindControl("rtvStruttura"));
 vPersistenceTree.ControlType = typeof(Telerik.Web.UI.RadTreeView);
RadPersistenceManager.PersistenceSettings.Add(vPersistenceTree);

CookieStorageProvider is the class of this example: https://demos.telerik.com/aspnet-ajax/persistence-framework/examples/custom-storage-provider/defaultcs.aspx

I use two button to save/load state

protected void btnSaveState_Click(object sender, EventArgs e)
   {
           RadPersistenceManager.SaveState();
   }
 
   protected void btnLoadState_Click(object sender, EventArgs e)
   {
           string key = GetPersistenceManagerKey();
           if (Request.Cookies[key] != null)
           {
               RadPersistenceManager.LoadState();
           }
   }

 

When I save a state I receive only this code

<?xml version="1.0"?>
<ArrayOfRadControlState xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <RadControlState>
    <ControlSettings />
    <UniqueId>Telerik.Web.UI_PersistanceManager_CustomSettings</UniqueId>
  </RadControlState>
</ArrayOfRadControlState>

 

Where am I doing wrong? Why am I not getting the status of the RadTreeView?

I use Telerik Ajax Q2 2012.

Thanks

Vessy
Telerik team
 answered on 08 Sep 2020
1 answer
44 views

We are getting this inconsistency in the xml generated by the persistence framework, where by for some some instances the visible tag under PersistableColumnSetting is setting to false. 

            <PersistableColumnSetting>

              <UniqueName>PermitID</UniqueName>
              <Visible>false</Visible>
              <Display>false</Display>
              <SortExpression />
              <GroupByExpression />
              <OrderIndex>2</OrderIndex>
              <CurrentFilterFunction>NoFilter</CurrentFilterFunction>
              <CurrentFilterValue />
              <AndCurrentFilterFunction>NoFilter</AndCurrentFilterFunction>
              <AndCurrentFilterValue />
              <Width />
              <Aggregate>None</Aggregate>
            </PersistableColumnSetting>

 

and these seem to happen to columns that are with Display set to false, this is ruining the our grid because we need these column in OnItemDataBound and these columns become blank.

                        <telerik:GridBoundColumn DataType="System.Int32" ReadOnly="True" Display="False" Exportable="False" UniqueName="PermitID" DataField="PermitID">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="TenantID" DataType="System.Int32" Display="False" ReadOnly="True" Exportable="False" UniqueName="TenantID" />
                        <telerik:GridBoundColumn DataField="PermitGUID" DataType="System.Guid" UniqueName="PermitGUID" Display="False" Exportable="False" ReadOnly="True">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderStyle-Width="115px" FilterControlWidth="50px" FilterControlAltText="Filter Ref column" Aggregate="Count" FooterAggregateFormatString="{0} items" DataField="PermitRef" HeaderText="Permit Ref" SortExpression="PermitRef" UniqueName="PermitRef" ItemStyle-Font-Underline="true" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true"/>

 

We are finding it hard to debug because whenever we test, visible tag is always set to true, but some of our users are experiencing this. What triggers persistence framework to set visibility to false?

 

 

Vessy
Telerik team
 answered on 19 Nov 2019
4 answers
138 views
Hi,
The examples only gives the option of saving/loading of the state by buttons.
i have added the persistence manager to the page.
Is it possible for an persistence enabled control to save/load this automatically.
For example if I creates a splitter and I change the position on the client and on the return after postback it will remain on the same position and if I close the application and open its it will remember that position ?
At the moment it goes back to the original position after postback. Perhaps I have missed a setting on the splitter ?

Best Regards
Ole Oscar
n/a
Top achievements
Rank 1
 answered on 05 Jul 2019
9 answers
180 views
Hello,

could you please provide more examples, how to save or persist control's state ? Some simple examples for ComboBox, Grid and PanelBar ? I use C# in combination with master page...

Thank you.

Best regards

Vasssek
Alex
Top achievements
Rank 1
 answered on 27 May 2019
8 answers
292 views

I have a situation where the RadGrid Filter criteria is saved, but, the RadGrid doesn't execute the Filter expression (yes, I tried ReBind()) upon re-loading Persistence.  Also, Sorts are not re-loaded either.  Only the Filter criteria value is re-loaded upon returning to the page.

 

I have a RadTabStrip with (3) RadGrids.  I implemented RadPersistenceManager with PersistenceSettings for each RadGrid, loading and saving with Page_Load and Page_Unload (code below, if needed).  Everything was working great; Sort & Filter were the same when I returned from exiting the app or returning from another page.  Something changed, though.  I'm not sure where.  The RadGrid Filter criteria is saved, but, the RadGrid doesn't execute the Filter expression, and the Sorts don't re-load.  What could've possibly happened to cause this?

 

 

 <telerik:RadPersistenceManager ID="RadPersistenceManager_AssetTabs" runat="server">
    <PersistenceSettings>
        <telerik:PersistenceSetting ControlID="RadGrid1" />
        <telerik:PersistenceSetting ControlID="RadGrid2" />
        <telerik:PersistenceSetting ControlID="RadGrid3" />
    </PersistenceSettings>
</telerik:RadPersistenceManager>

 

protected void Page_Load(object sender, EventArgs e)

{
    string theKey = "TelerikAspNetRadControlsPersistedState";
    theKey = "StorageProvider_" + Session["UserName"].ToString();
    RadPersistenceManager_AssetTabs.StorageProviderKey = theKey;
    var fileNameAndPath = Server.MapPath("~/App_Data/" + theKey);

    //bool IsPersistenceLoaded = (bool)Session["PersistenceLoaded"];
    if (File.Exists(fileNameAndPath)) // && !IsPersistenceLoaded)
    {
        try
        {
            if (!IsPostBack)
            {
                RadPersistenceManager_AssetTabs.LoadState();
            }
        }
        catch (Exception theError)
        {
            Console.WriteLine("Exception for RadPersistenceManager LoadState: {0}", theError);
        }
    }
}

protected void Page_Unload(object sender, System.EventArgs e)
{
    try
    {
        RadPersistenceManager_AssetTabs.SaveState();
    }
    catch (Exception theError)
    {
        Console.WriteLine("Exception for RadPersistenceManager SaveState: {0}", theError);
    }
}

​

John
Top achievements
Rank 1
 answered on 04 Apr 2019
11 answers
297 views

Hi,

I have requirement where on 1 main aspx page i have 3 user controls(ascx).

Each ascx has a radgrid.I need to save state of each grid in database individually on gridbutton click.

Tried- I have created a custom storage provider and implemented methods SaveStateToStorage and LoadStateFromStorage.

Now if I apply persistencemanger on any ascx and call .savestate it goes to SaveStateToStorage  and all works fine.

But if I move persistencemanger  to aspx and apply persistencemangerproxy on ascx nothing works.

Sample code-

on aspx-  <telerik:RadPersistenceManager  ID="mainPersistenceManager" runat="server">   </telerik:RadPersistenceManager>

on aspx.vb- pageload event -  mainPersistenceManager.StorageProvider = New SettingsStorageProvider() 'This is my custom storage provider

on ascx- <telerik:RadPersistenceManagerProxy  ID="PersistenceManagerProxy1" runat="server" UniqueKey ="1">

        <PersistenceSettings>
            <telerik:PersistenceSetting ControlID="radgrid1" />
        </PersistenceSettings>
    </telerik:RadPersistenceManagerProxy>

on ascx.vb- on button click event-

 Dim ascxPersistenceManager As RadPersistenceManager

 ascxPersistenceManager = RadPersistenceManager.GetCurrent(Page)
       ascxPersistenceManager.PersistenceSettings.AddSetting("radgrid1")
        SettingsStorageProvider.StorageProviderKey = Key
        ascxPersistenceManager .SaveState()

 

Now on button click i get exception that it could not find control with id=radgrid1

but if i comment this line "ascxPersistenceManager.PersistenceSettings.AddSetting("radgrid1")"

somehow it calls "LoadStateFromStorage" of my custom storage provider rather than "SaveStateToStorage" method.

 

Incase when i dont use proxy and put persistencemanger in ascx only it hits correct method but not in case of proxy.

Please help 

 

Thanks,

Ankita

Vessy
Telerik team
 answered on 11 Apr 2018
1 answer
470 views

I have the following ComboBox on my page but although the Text value is persisted, the selected value is not. Therefore my grid loads all items regardless of what is in the ComboBox when the page loads. What do I need to change?

<telerik:RadComboBox runat="server" DataSourceID="AllWaterSystems" DataTextField="displayName" DataValueField="pwsid" EmptyMessage="Water System" Filter="Contains" Width="350" ID="SelectedWaterSystem" EnableItemCaching="True" OnClientDropDownOpening="RefreshHeight">
    <HeaderTemplate>
        <ul>
            <li class="col1">PWSID</li>
            <li class="col2">Name</li>
        </ul>
    </HeaderTemplate>
    <ItemTemplate>
        <ul>
            <li class="col1"><%# DataBinder.Eval(Container.DataItem, "PWSID") %></li>
            <li class="col2"><%# DataBinder.Eval(Container.DataItem, "Name") %></li>
        </ul>
    </ItemTemplate>
</telerik:RadComboBox>

 

Vessy
Telerik team
 answered on 02 Mar 2018
1 answer
108 views
Is it possible to use persistence framework to persist column settings when the radgrid is set AutoGeneratedColumns =true? 
Marc
Top achievements
Rank 1
 answered on 28 Feb 2018
0 answers
73 views
I am Sathesh,  i am using RadPersistenceManager for saving grid settings, If i use this RadPersistenceManager control the RadGrid client side row selected event not fired. If i remove the RadPersistenceManager from the page the row selection event is fired correctly. This issue is arises in the local server if i published. But its working correctly in local development machine. 
sathesh
Top achievements
Rank 1
 asked on 30 Nov 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?