I have a splitter with two panes (left and right). The splitter has collapse direction of both. In each pane is a grid. The right grid loads 1000 records. The left grid loads 200 records.
I am noticing a significant delay when attempting to resize or move the browser window. Are there any best practices we can use to increase this performance?
- Adam
4 Answers, 1 is accepted
If you disable viewstate on the grid or store page viewstate in somewhere else than a page, you should have better performance.
Disabling viewstate requires some work to be done (depending on scenario you are using - Refer to Grid Event Sequence
cs:
protected void UnbilledDocumentGrid_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
UnbilledDocumentGrid.DataSource = GenerateDocTable();
}
protected void UnbilledContainerGrid_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
UnbilledContainerGrid.DataSource = GenerateContTable();
}
public DataTable GenerateContTable()
{
DataTable retTable = new DataTable();
retTable.Columns.Add(
new DataColumn("CustomerAndSiteNumber"));
retTable.Columns.Add(
new DataColumn("TranDate"));
retTable.Columns.Add(
new DataColumn("TranCode"));
retTable.Columns.Add(
new DataColumn("BarCode"));
retTable.Columns.Add(
new DataColumn("ServiceCode"));
retTable.Columns.Add(
new DataColumn("ContainerWeightQty"));
for (int i = 0; i < 1000; i++)
{
DataRow row = retTable.NewRow();
row[
"CustomerAndSiteNumber"] = "1234567-001";
row[
"TranDate"] = new DateTime(2009, 1, 1);
row[
"TranCode"] = new DateTime(2009, 1, 1);
row[
"ServiceCode"] = "TB01";
row[
"BarCode"] = "12345ABCD";
row[
"ContainerWeightQty"] = 10;
retTable.Rows.Add(row);
}
return retTable;
}
public DataTable GenerateDocTable()
{
DataTable retTable = new DataTable();
retTable.Columns.Add(
new DataColumn("CustomerAndSiteNumber"));
retTable.Columns.Add(
new DataColumn("DocumentNumber"));
retTable.Columns.Add(
new DataColumn("DocumentDate"));
retTable.Columns.Add(
new DataColumn("NumberOfContainers"));
retTable.Columns.Add(
new DataColumn("ContainerWeightQty"));
retTable.Columns.Add(
new DataColumn("BarCode"));
retTable.Columns.Add(
new DataColumn("ServiceCode"));
retTable.Columns.Add(
new DataColumn("UnbilledConts"));
retTable.Columns.Add(
new DataColumn("TrackingNumber"));
for (int i = 0; i < 1000; i++)
{
DataRow row = retTable.NewRow();
row[
"CustomerAndSiteNumber"] = "1234567-001";
row[
"DocumentNumber"] = "MD001001";
row[
"DocumentDate"] = new DateTime(2009, 1, 1);
row[
"NumberOfContainers"] = 10;
row[
"ContainerWeightQty"] = 10;
row[
"BarCode"] = "12345ABCD";
row[
"ServiceCode"] = "TB01";
row[
"UnbilledConts"] = "Y";
row[
"TrackingNumber"] = "ABCXYZ";
retTable.Rows.Add(row);
}
return retTable;
}
aspx:
<
form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div style="width:100%;height:100%">
<telerik:RadSplitter ID="RadSplitter1" runat="server" Width="100%" Height="100%">
<telerik:RadPane runat="server" ID="pane1" Width="50%">
<div RadResizeStopLookup="true" RadShowStopLookup="true" >
<telerik:RadGrid ID="UnbilledDocumentGrid" GridLines="Both" AllowMultiRowSelection="False"
EnableAJAX="True" ShowStatusBar="True" Width="99%" AllowPaging="False"
AllowSorting="False" runat="server" Skin="Web20"
onneeddatasource="UnbilledDocumentGrid_NeedDataSource">
<ClientSettings AllowKeyboardNavigation="True">
<Resizing AllowColumnResize="True" AllowRowResize="False" />
<Selecting AllowRowSelect="True" />
<Scrolling AllowScroll="true" UseStaticHeaders="true" />
</ClientSettings>
<MasterTableView AutoGenerateColumns="false" DataKeyNames="CustomerAndSiteNumber"
ClientDataKeyNames="BarCode" Width="100%">
<Columns>
<telerik:GridBoundColumn HeaderText="Cust - Site" HeaderStyle-Width="10%" DataField="CustomerAndSiteNumber"
UniqueName="CustomerAndSiteNumber" />
<telerik:GridBoundColumn SortExpression="DocumentNumber" HeaderStyle-Width="15%"
HeaderText="Document Number" DataField="DocumentNumber" UniqueName="DocumentNumber">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="DocumentDate" HeaderStyle-Width="20%" HeaderText="Date"
DataField="DocumentDate" UniqueName="DocumentDate" DataFormatString="{0:d}" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="NumberOfContainers" HeaderStyle-Width="10%"
HeaderText="#Conts" DataField="NumberOfContainers" UniqueName="NumberOfContainers">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="ContainerWeightQty" HeaderStyle-Width="10%"
HeaderText="Conts Wt" DataField="ContainerWeightQty" UniqueName="ContainerWeightQty">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="BarCode" HeaderStyle-Width="25%" HeaderText="Conts Wt/Zero Wt"
DataField="BarCode" UniqueName="BarCode">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="ServiceCode" HeaderStyle-Width="8%" HeaderText="Code"
DataField="ServiceCode" UniqueName="ServiceCode">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="UnbilledConts" HeaderStyle-Width="2%" HeaderText="Unbill Conts"
DataField="UnbilledConts" UniqueName="UnbilledConts">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="TrackingNumber" HeaderStyle-Width="8%" HeaderText="Tracking #"
DataField="TrackingNumber" UniqueName="TrackingNumber">
</telerik:GridBoundColumn>
</Columns>
<NoRecordsTemplate>
<div class="NoRecordText">No records to display.</div>
</NoRecordsTemplate>
</MasterTableView>
<PagerStyle Mode="NumericPages" />
</telerik:RadGrid>
</div>
</telerik:RadPane>
<telerik:RadSplitBar runat="server" ID="RadSplitbarCommon" CollapseMode="Both" />
<telerik:RadPane runat="server" ID="UnbilledContainerPane" Width="50%">
<div RadResizeStopLookup="true" RadShowStopLookup="true" >
<telerik:RadGrid ID="UnbilledContainerGrid" GridLines="Both" AllowMultiRowSelection="False"
EnableAJAX="True" ShowStatusBar="True" PageSize="10" Width="99%" AllowPaging="False"
AllowSorting="False" runat="server" Skin="Web20"
onneeddatasource="UnbilledContainerGrid_NeedDataSource">
<ClientSettings AllowKeyboardNavigation="True" AllowColumnsReorder="True" ReorderColumnsOnClient="True">
<Resizing AllowColumnResize="True" AllowRowResize="False" />
<Selecting AllowRowSelect="True" />
<Scrolling AllowScroll="true" UseStaticHeaders="true" />
</ClientSettings>
<MasterTableView AutoGenerateColumns="false" DataKeyNames="BarCode"
ClientDataKeyNames="BarCode" Width="100%">
<Columns>
<telerik:GridBoundColumn HeaderText="Cust - Site" HeaderStyle-Width="10%" DataField="CustomerAndSiteNumber"
UniqueName="CustomerAndSiteNumber" />
<telerik:GridBoundColumn SortExpression="TranDate" HeaderStyle-Width="15%" HeaderText="First Tran Date"
DataField="TranDate" UniqueName="TranDate" DataFormatString="{0:d}">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="DocumentDate" HeaderStyle-Width="5%" HeaderText="First Tran Code"
DataField="TranCode" UniqueName="TranCode">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="BarCode" HeaderStyle-Width="25%" HeaderText="Cont ID"
DataField="BarCode" UniqueName="BarCode">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="ServiceCode" HeaderStyle-Width="5%" HeaderText="Code"
DataField="ServiceCode" UniqueName="ServiceCode">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="ContainerWeightQty" HeaderStyle-Width="10%"
HeaderText="Wt" DataField="ContainerWeightQty" UniqueName="ContainerWeightQty">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<PagerStyle Mode="NumericPages" />
</telerik:RadGrid>
</div>
</telerik:RadPane>
</telerik:RadSplitter>
</div>
</form>
I have seen several posts about this issue but none that seem to definitivly address it.... any thoughts.
(maybe I should repost in the Splitter forum)
- Thanks,
You can either store the grid viewstate in the session as explained here or use RadCompression with its page adapters for this purpose.
Best regards,
Sebastian
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.