This is a migrated thread and some comments may be shown as answers.

Performance Issue with Grid Page Load

2 Answers 126 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lynn
Top achievements
Rank 2
Lynn asked on 06 Dec 2011, 11:36 PM
I am having a performance problem at page load with the Grid.
I have a particular grid (design code below, screen image attached) that loads 1000 records in about 2 seconds.  There is no paging, but scrolling is utilized.  That seems pretty good to me.

However, when I merge the pages from this particular project into an existing web site, the load time for this very same page, with the very same database connection, and the very same data records, goes to 10 to 12 seconds.

The only difference I can find is that the larger web site has master pages that utilize a standard script manager, not a Telerik script manager.

The display code (.aspx) for the grid is:

<asp:Panel ID="Panel1" runat="server">
    <asp:Panel ID="Panel2" Visible="false" runat="server">
        <telerik:RadGrid AutoGenerateColumns="false" ID="SignersGrid" OnItemCommand="SignersGrid_ItemCommand" runat="server" Width="765px"
            Height="410px"
            OnItemDataBound="SignersGrid_ItemDataBound" AllowSorting="true" AllowFilteringByColumn="true"
            AllowPaging="true" PageSize="8" CommandItemDisplay="Bottom"
            BorderWidth="1px" BorderColor="#999999" EnableEmbeddedSkins="true" Skin="Default"
            DataSourceID="SQLDataSource1"
            ShowStatusBar="true"
            ShowFooter="false" GridLines="None" >
            <PagerStyle Mode="NextPrevAndNumeric" />
            <GroupingSettings CaseSensitive="false" />
            <StatusBarSettings ReadyText="Ready" LoadingText="Loading..." />
                <MasterTableView AutoGenerateColumns="false" EditMode="InPlace" AllowFilteringByColumn="True"
                    ShowFooter="True" TableLayout="Auto" DataKeyNames="VoterSignatureId"  >
                    <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                    </ExpandCollapseColumn>
                <Columns>
                    <telerik:GridBoundColumn HeaderStyle-Width="125px" HeaderText="First Name" UniqueName="FirstName" DataField="FirstName" SortExpression="FirstName" >
                    </telerik:GridBoundColumn>
 
                    <telerik:GridBoundColumn HeaderStyle-Width="125px" UniqueName="LastName" HeaderText="Last Name" DataField="LastName" SortExpression="LastName" >
                    </telerik:GridBoundColumn>
 
                    <telerik:GridBoundColumn HeaderStyle-Width="350px" UniqueName="VoterAddress" HeaderText="Address" DataField="Address" SortExpression="Address"  >
                    </telerik:GridBoundColumn >
 
                    <telerik:GridButtonColumn HeaderStyle-Width="135px" DataTextFormatString="Remove" ButtonType="PushButton" UniqueName="RemoveSigner"
                        ConfirmText="Are you certain that you want to remove this signature?"  Text="Remove"
                        HeaderText="Remove" CommandName="RemoveSigner" CommandArgument="VoterSignatureId" DataTextField="VoterSignatureId" >
                    </telerik:GridButtonColumn>
 
                    <telerik:GridBoundColumn UniqueName="VoterSignatureId" HeaderText="Id" DataField="VoterSignatureId" Visible="false" >
                    </telerik:GridBoundColumn >
                </Columns>
                <EditFormSettings>
                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                    </EditColumn>
                </EditFormSettings>
            </MasterTableView>
            <ClientSettings>
                <Scrolling AllowScroll="true" UseStaticHeaders="true" />
            </ClientSettings>
            <FilterMenu EnableImageSprites="False">
            </FilterMenu>
            <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
            </HeaderContextMenu>
        </telerik:RadGrid>
    </asp:Panel>
</asp:Panel>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"
    Height="100px"  Width="100px" Transparency="50"
>
<img alt="Loading..." src="ajax-loader.gif" style="border: 0; height: 40px; width: 40px;" />
</telerik:RadAjaxLoadingPanel>

There is some code in the code-behind file.  That code is:

protected void Page_Init(object sender, EventArgs e)
{
        string griddatasource = "SELECT VoterSignatureId, PetitionId, LastName, FirstName, [Address] FROM VoterSignatures ";
        string gridWHERE = "WHERE VoterSignatureStatusId = 1 AND PetitionId = " + Request.QueryString["PID"];
        SqlDataSource1.SelectCommand = griddatasource + gridWHERE;
}
 
protected void SignersGrid_ItemCommand(Object source, Telerik.Web.UI.GridCommandEventArgs e)
{
    if (e.CommandName == "RemoveSigner")
    {
        //  First we need to get the key value of the record the user wants to remove from the lsit
        Object index = e.CommandArgument;
        Int16 iSignerRecKey = Convert.ToInt16(index);
 
        //  Now we can get the record, change it (remove it from the list), and update it
        ElectronicPetitionSystemDataContext efdc = new ElectronicPetitionSystemDataContext();
        VoterSignature vs = efdc.VoterSignatures.Single(vrec => vrec.VoterSignatureId == iSignerRecKey);
        vs.VoterSignatureStatusId = 2;
        efdc.SubmitChanges();
        this.SignersGrid.Rebind();
    }
}
 
protected void SignersGrid_ItemDataBound(Object sender, Telerik.Web.UI.GridItemEventArgs e)
// 
{
    if (e.Item is GridDataItem)
    {
        //GridDataItem dataItem = e.Item as GridDataItem;
        //Button button_Renamed = (Button)dataItem["RemoveSigner"].Controls[0];
        //button_Renamed.CommandArgument = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "VoterSignatureId"));
 
        //String sMsg = "";
        //sMsg = "Are you certain that you want to remove " + Convert.ToString(DataBinder.Eval(e.Item.DataItem, "FirstName")) + "?";
 
        //  Telerik example for this is located at:
    }
}
 
protected void SignersGrid_AjaxRequest(Object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
{
    if (e.Argument == "InitialPageLoad")
    {
        //System.Threading.Thread.Sleep(1000);
        this.Panel2.Visible = true;
    }
}

The screen capture of the grid is attached.

Do you have any suggestions of what I could look at to run down this severe performance change from site to site?

Thanks in advance!

Lynn


2 Answers, 1 is accepted

Sort by
0
Lynn
Top achievements
Rank 2
answered on 06 Dec 2011, 11:58 PM
Adding additional information...

I ran another test replacing the existing non-Telerik script manager with a Telerik script manager.  The results did not change. The grid still took 12 seconds or more to load.
I should add that the larger web site I am trying to merge these new pages in with also uses the old "AjaxControlToolkit".  Would this play a part in this poor performance?

Lynn
0
Shinu
Top achievements
Rank 2
answered on 07 Dec 2011, 05:01 AM
Hello Lynn,

Try binding the grid with advanced data binding using NeedDataSource event. Also check the following help documentation which explains how to optimize the performance of RadGrid.
Client/server grid performance optimizations

-Shinu.
Tags
Grid
Asked by
Lynn
Top achievements
Rank 2
Answers by
Lynn
Top achievements
Rank 2
Shinu
Top achievements
Rank 2
Share this question
or