Hi,
We are using the hierarchical functionality of the Telerik grid and we have hierarchy upto four level and the total records for all this levels comes upto around 1300 records and we are not applying any paging and when we try to run the page, it takes around 55 seconds to load the page and the html page size comes to around 4.5 MB.
we applied the compression technique as well but still the page was taking around 45 seconds to load with the viewstate which is required for the Hierarchical grid and also the loading time of the page is unacceptable to the Client.
We are attaching the source code. Please look into it and let us know if there is any optimization possible to speed up the execution time of the page.
Regards,
Hitesh
We are using the hierarchical functionality of the Telerik grid and we have hierarchy upto four level and the total records for all this levels comes upto around 1300 records and we are not applying any paging and when we try to run the page, it takes around 55 seconds to load the page and the html page size comes to around 4.5 MB.
we applied the compression technique as well but still the page was taking around 45 seconds to load with the viewstate which is required for the Hierarchical grid and also the loading time of the page is unacceptable to the Client.
We are attaching the source code. Please look into it and let us know if there is any optimization possible to speed up the execution time of the page.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RelationGrid.aspx.cs" Inherits="RelationGrid"
Debug="true" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
></
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
/>
<
div
>
<% Response.Write(DateTime.Now.ToString()); %>
<
telerik:RadGrid
ID
=
"RadGrid1"
OnPreRender
=
"RadGrid1_PreRender"
runat
=
"server"
ShowStatusBar
=
"true"
DataSourceID
=
"SqlDataSource1"
AutoGenerateColumns
=
"False"
AllowSorting
=
"True"
AllowMultiRowSelection
=
"False"
GridLines
=
"None"
EnableViewState
=
"true"
>
<
PagerStyle
Mode
=
"NumericPages"
></
PagerStyle
>
<
MasterTableView
DataSourceID
=
"SqlDataSource1"
DataKeyNames
=
"nGroupID"
AllowMultiColumnSorting
=
"True"
HierarchyDefaultExpanded
=
"true"
>
<
DetailTables
>
<
telerik:GridTableView
DataKeyNames
=
"nSubGroupID"
DataSourceID
=
"SqlDataSource2"
Width
=
"100%"
runat
=
"server"
HierarchyDefaultExpanded
=
"true"
EnableViewState
=
"true"
>
<
ParentTableRelation
>
<
telerik:GridRelationFields
DetailKeyField
=
"nGroupID"
MasterKeyField
=
"nGroupID"
/>
</
ParentTableRelation
>
<
DetailTables
>
<
telerik:GridTableView
DataKeyNames
=
"QuoteSubID"
DataSourceID
=
"SqlDataSource3"
Width
=
"100%"
runat
=
"server"
HierarchyDefaultExpanded
=
"true"
EnableViewState
=
"true"
>
<
ParentTableRelation
>
<
telerik:GridRelationFields
DetailKeyField
=
"nSubGroupID"
MasterKeyField
=
"nSubGroupID"
/>
</
ParentTableRelation
>
<
DetailTables
>
<
telerik:GridTableView
DataKeyNames
=
"CatId"
DataSourceID
=
"SqlDataSource4"
Width
=
"100%"
runat
=
"server"
HierarchyDefaultExpanded
=
"true"
EnableViewState
=
"true"
>
<
ParentTableRelation
>
<
telerik:GridRelationFields
DetailKeyField
=
"QuoteSubID"
MasterKeyField
=
"QuoteSubID"
/>
</
ParentTableRelation
>
<
Columns
>
<
telerik:GridBoundColumn
HeaderText
=
"KIT ITEM"
DataField
=
"CDescription"
UniqueName
=
"CDescription"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
HeaderText
=
"Quantity"
DataField
=
"quotekitqty"
UniqueName
=
"quotekitqty"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
HeaderText
=
"Type"
DataField
=
"cattype"
UniqueName
=
"cattype"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
telerik:GridTableView
>
</
DetailTables
>
<
Columns
>
<
telerik:GridBoundColumn
HeaderText
=
"QuoteSubID"
DataField
=
"QuoteSubID"
UniqueName
=
"QuoteSubID"
>
</
telerik:GridBoundColumn
>
<
telerik:GridCheckBoxColumn
HeaderText
=
"K"
DataField
=
"CatPrint"
UniqueName
=
"CatPrint"
>
<
HeaderStyle
Font-Bold
=
"true"
/>
</
telerik:GridCheckBoxColumn
>
<
telerik:GridCheckBoxColumn
HeaderText
=
"B"
DataField
=
"QuoteHeading"
UniqueName
=
"QuoteHeading"
>
<
HeaderStyle
Font-Bold
=
"true"
/>
</
telerik:GridCheckBoxColumn
>
<
telerik:GridCheckBoxColumn
HeaderText
=
"I"
DataField
=
"nItalic"
UniqueName
=
"nItalic"
>
<
HeaderStyle
Font-Bold
=
"true"
Font-Italic
=
"true"
/>
</
telerik:GridCheckBoxColumn
>
<
telerik:GridBoundColumn
HeaderText
=
"Use Quantity"
DataField
=
"Quantity"
UniqueName
=
"Quantity"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
HeaderText
=
"Bill Quantity"
DataField
=
"BillQuantity"
UniqueName
=
"Quantity"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
HeaderText
=
"Period"
DataField
=
"Period"
UniqueName
=
"Period"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
HeaderText
=
"CDescription"
DataField
=
"CDescription"
UniqueName
=
"CDescription"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
HeaderText
=
"Note"
DataField
=
"QuoteDescription"
UniqueName
=
"QuoteDescription"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
HeaderText
=
"Reg Rate"
DataField
=
"SuggestedRate"
UniqueName
=
"SuggestedRate"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
HeaderText
=
"Disc%"
DataField
=
"DiscountPercent"
UniqueName
=
"DiscountPercent"
>
<
HeaderStyle
ForeColor
=
"AliceBlue"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
HeaderText
=
"Disc Rate"
DataField
=
"DiscountRate"
UniqueName
=
"DiscountRate"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
HeaderText
=
"Line Total"
DataField
=
"Sum"
UniqueName
=
"Sum"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
telerik:GridTableView
>
</
DetailTables
>
<
Columns
>
<%--<
telerik:GridBoundColumn
HeaderText
=
"SubGroupID"
DataField
=
"nSubGroupID"
UniqueName
=
"nSubGroupID"
>
<
HeaderStyle
BackColor
=
"Gray"
ForeColor
=
"Red"
/>
</
telerik:GridBoundColumn
>--%>
<
telerik:GridBoundColumn
HeaderText
=
"SubGroup Name"
DataField
=
"tSubGroupName"
UniqueName
=
"tSubGroupName"
>
<
ItemStyle
BackColor
=
"Gray"
ForeColor
=
"Red"
/>
</
telerik:GridBoundColumn
>
</
Columns
>
</
telerik:GridTableView
>
</
DetailTables
>
<
Columns
>
<%--<
telerik:GridBoundColumn
HeaderText
=
"GroupID"
DataField
=
"nGroupID"
UniqueName
=
"nGroupID"
>
<
HeaderStyle
BackColor
=
"Gray"
ForeColor
=
"Red"
/>
</
telerik:GridBoundColumn
>--%>
<
telerik:GridBoundColumn
HeaderText
=
"GroupName"
DataField
=
"tGroupName"
UniqueName
=
"tGroupName"
>
<
ItemStyle
BackColor
=
"Gray"
ForeColor
=
"Red"
/>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
<
asp:SqlDataSource
ID
=
"SqlDataSource1"
runat
=
"server"
SelectCommand="select * from GroupMaster with(noLock)
where
tQuoteID
=
43617
ORDER BY (CASE WHEN
tgroupname
=
'[EXTRAS]'
THEN 99991 ELSE (case when
tgroupname
=
'[ADJUSTMENTS]'
then 99992 ELSE (case WHEN
tgroupname
=
'[INTERNAL USE ONLY]'
THEN 99993 ELSE
tGroupLineNumber END) END) END ) "
ConnectionString="<%$ ConnectionStrings:DatasetConnString %>"></
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"SqlDataSource2"
ConnectionString="<%$ ConnectionStrings:DatasetConnString %>"
ProviderName="System.Data.SqlClient" SelectCommand="select * from subgroupmaster with(noLock) where
ngroupid=@nGroupID order by tsubgrouplinenumber"
runat="server">
<
SelectParameters
>
<
asp:SessionParameter
Name
=
"nGroupID"
SessionField
=
"nGroupID"
Type
=
"string"
/>
</
SelectParameters
>
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"SqlDataSource3"
ConnectionString="<%$ ConnectionStrings:DatasetConnString %>"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT
dbo.tblQuoteSub.QuoteSubSync,
dbo.tblQuoteSub.QuoteSubID,
dbo.tblQuoteSub.QuoteId,
dbo.tblQuoteSub.nSubGroupID,
dbo.tblQuoteSub.nGroupID,
dbo.tblQuoteSub.CatPrint,
dbo.tblCat.CatType,
dbo.tblQuoteSub.LineNumber,
dbo.tblQuoteSub.QuoteHeading,
dbo.tblQuoteSub.nItalic,
dbo.tblQuoteSub.Quantity,
dbo.tblQuoteSub.BillQuantity,
dbo.tblQuoteSub.Period,
dbo.tblQuoteSub.CategoryID,
dbo.tblCat.CDescription,
dbo.tblQuoteSub.QuoteDescription,
dbo.tblQuoteSub.SuggestedRate,
dbo.tblQuoteSub.DiscountPercent,
dbo.tblQuoteSub.DiscountRate,
(dbo.tblQuoteSub.SuggestedRate * dbo.tblQuoteSub.Period * dbo.tblQuoteSub.BillQuantity)
* (1 - CAST(dbo.tblQuoteSub.DiscountPercent AS float) / 100) AS [Sum],
dbo.tblQuoteSub.QuoteKitParentId,
dbo.tblQuoteSub.EquipTotal,
dbo.tblQuoteSub.EquipAvailable,
dbo.tblQuoteSub.Equip_NonConfirmed,
dbo.tblQuoteSub.CompanyWideEquipAvailable,
dbo.tblQuoteSub.QuoteSubParentId,
dbo.tblQuoteSub.QuoteCancelParentId,
dbo.tblQuoteSub.QuoteCancelChildId,
dbo.tblQuoteSub.QuoteSubstituteParentId,
dbo.tblQuoteSub.QuoteFloatParentId,
dbo.tblQuoteSub.QuoteSFRParentId,
dbo.tblQuoteSub.QuoteSFRChildId, dbo.tblQuoteSub.QuoteSubEnteredBy, dbo.tblQuoteSub.QuoteSubEnteredDate,
dbo.tblQuoteSub.QuoteSubLastModifiedBy, dbo.tblQuoteSub.QuoteSubLastModifiedDate,
dbo.tblQuoteSub.QuoteHeaderFooterId
FROM
dbo.tblQuoteSub with(noLock) INNER JOIN
dbo.tblCat with(noLock) ON dbo.tblQuoteSub.CategoryID = dbo.tblCat.CatId INNER JOIN
dbo.SubGroupMaster with(noLock) ON dbo.tblQuoteSub.nSubGroupID =
dbo.SubGroupMaster.nSubGroupID INNER JOIN
dbo.GroupMaster with(noLock) ON dbo.SubGroupMaster.nGroupID = dbo.GroupMaster.nGroupID
where tblquotesub.quoteid=43617 and tblquotesub.nsubgroupid=@nSubGroupID and (quotekitparentid = 0 OR
QuoteKitParentID IS NULL)
ORDER BY dbo.tblQuoteSub.LineNumber" runat="server">
<
SelectParameters
>
<
asp:SessionParameter
Name
=
"nSubGroupID"
SessionField
=
"nSubGroupID"
Type
=
"Int32"
/>
</
SelectParameters
>
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"SqlDataSource4"
ConnectionString="<%$ ConnectionStrings:DatasetConnString %>"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT tblcat.cattype,tblCat.CDescription,
tblCat.CatId, quotekitqty, tblquotesub.quotecatkitautoid, QuoteSubID,Quantity,BillQuantity ,
QuoteKitQty,QuoteKitParentId FROM tblQuoteSub with(noLock) INNER JOIN tblCat with(noLock) ON
tblQuoteSub.CategoryID = tblCat.CatId where QuoteKitParentId=@QuoteSubID ORDER BY linenumber" runat="server">
<
SelectParameters
>
<
asp:SessionParameter
Name
=
"QuoteSubID"
SessionField
=
"QuoteSubID"
Type
=
"Int32"
/>
</
SelectParameters
>
</
asp:SqlDataSource
>
<% Response.Write(DateTime.Now.ToString()); %>
</
div
>
</
form
>
</
body
>
</
html
>
Regards,
Hitesh