I have a bunch of different docks containing a listviews on a page. See example below. We are using custom docklayout storage -see below. My question is why is LoadStateFromStorage called before a paging event and then SaveStateToStorage is called after it. So whenever a user pages, there are 3 calls to the database.
Public Class DockLayoutStorage
Implements IStateStorageProvider
Public Function LoadStateFromStorage(key As String) As String Implements IStateStorageProvider.LoadStateFromStorage
Dim params As List(Of SqlParameter)
params = New List(Of SqlParameter)
params.Add(New SqlParameter("@User_Id", key))
Return OGC.Toolkit.Misc.DataAccess.ExecuteScalar("GetDockState", params, "csxxxx").ToString
End Function
Public Sub SaveStateToStorage(key As String, serializedState As String) Implements IStateStorageProvider.SaveStateToStorage
Dim params As List(Of SqlParameter)
params = New List(Of SqlParameter)
params.Add(New SqlParameter("@User_Id", key))
params.Add(New SqlParameter("@Dock_State", serializedState))
OGC.Toolkit.Misc.DataAccess.ExecuteQuery("InsUpdDockStates", params, "csxxx")
End Sub
<telerik:RadDock runat="server" ID="dockNotifications" Title="Notifications" Style="margin-bottom: 5px; margin-top: 5px" DefaultCommands="ExpandCollapse" EnableAnimation="true"
AutoPostBack="true" DockMode="Docked" CommandsAutoPostBack="true" EnableRoundedCorners="true">
<ContentTemplate>
<telerik:RadAjaxPanel ID="upNotifications" runat="server" LoadingPanelID="uprgNotifications">
<asp:ListView runat="server" ID="lvNotifications" DataSourceID="odsNotifications">
<LayoutTemplate>
<asp:PlaceHolder runat="server" ID="itemPlaceHolder"></asp:PlaceHolder>
<telerik:RadDataPager ID="dpNotifications" runat="server" PagedControlID="lvNotifications" PageSize="5" Skin="Default" OnCommand="dp_Command">
<Fields>
<telerik:RadDataPagerButtonField FieldType="FirstPrev"></telerik:RadDataPagerButtonField>
<telerik:RadDataPagerButtonField FieldType="Numeric"></telerik:RadDataPagerButtonField>
<telerik:RadDataPagerButtonField FieldType="NextLast"></telerik:RadDataPagerButtonField>
<telerik:RadDataPagerPageSizeField PageSizeText="Page size: " PageSizes="5,10,20,50" HorizontalPosition="RightFloat" PageSizeControlType="RadDropDownList"></telerik:RadDataPagerPageSizeField>
</Fields>
</telerik:RadDataPager>
</LayoutTemplate>
<ItemTemplate>
<fieldset class="dock">
<legend style="font-weight: bold"><%#Eval("Notification_Header")%></legend>
<asp:Literal runat="server" ID="litNotificationText"></asp:Literal>
</fieldset>
</ItemTemplate>
<EmptyDataTemplate>
<div class="center" style="margin-top: 5px">No notifications available.</div>
</EmptyDataTemplate>
</asp:ListView>
<asp:ObjectDataSource ID="odsNotifications" runat="server" TypeName="xxx.DataAccess" SelectMethod="GetDataTable">
<SelectParameters>
<asp:Parameter Name="sProc" DefaultValue="xxxGetNotifications" />
<asp:Parameter Name="params" />
<asp:Parameter Name="connStr" DefaultValue="csxxx />
</SelectParameters>
</asp:ObjectDataSource>
</telerik:RadAjaxPanel>
<telerik:RadAjaxLoadingPanel ID="uprgNotifications" runat="server" Skin="Default" MinDisplayTime="0"></telerik:RadAjaxLoadingPanel>
</ContentTemplate>
</telerik:RadDock>