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

Grid takes 8 sec. time to load the data

1 Answer 87 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Parth
Top achievements
Rank 1
Parth asked on 20 Dec 2010, 03:43 PM
Hello,

I have a grid which takes 8 seconds to load the data and the same time to do all events. I checked the database stored procedure. But it takes less than a second. Can you please help me to improve the performance.

I am using RAD controls Q4 2006.

I am getting about 800 records with around 55 columns in each record. Out of 55 only 8 columns are visible in the grid but in edit mode all other columns are visible (only 5 are editable rest are disabled). I am using RadAjaxManager to show loading image. 

My Radgrid syntax is as shown below:
<telerik:RadGrid ID="RadGrid1" OnNeedDataSource="RadGrid1_NeedDataSource" runat="server" AllowPaging="True" EditItemStyle-Wrap="true"
                AllowSorting="True" AutoGenerateColumns="False" AllowAutomaticUpdates="True" 
                OnUpdateCommand="RadGrid1_UpdateCommand" AllowFilteringByColumn="True" Width="99%" PageSize="14"
                OnItemDataBound="RadGrid1_ItemDataBound" EnableLinqExpressions="false" OnItemCreated="RadGrid1_ItemCreated">
        
                <MasterTableView  AllowAutomaticDeletes="False" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" Width="100%" 
                    EditMode="EditForms" CommandItemDisplay="Top" CanRetrieveAllData="false"
                    DataKeyNames="profileid,submitid,applicationid,q12a_coded,q13a_coded,q15a_coded,q23a_coded,q24a_coded,q25a_coded,q29a_coded" >
                    
<telerik:RadGrid ID="RadGrid1" OnNeedDataSource="RadGrid1_NeedDataSource" runat="server" AllowPaging="True" EditItemStyle-Wrap="true" AllowSorting="True" AutoGenerateColumns="False" AllowAutomaticUpdates="True" OnUpdateCommand="RadGrid1_UpdateCommand" AllowFilteringByColumn="True" Width="99%" PageSize="14" OnItemDataBound="RadGrid1_ItemDataBound" EnableLinqExpressions="false" OnItemCreated="RadGrid1_ItemCreated">
         
<MasterTableView  AllowAutomaticDeletes="False" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" Width="100%" EditMode="EditForms" CommandItemDisplay="Top" CanRetrieveAllData="false" DataKeyNames="proid,subid,appid,q12a,q13a,q15a,q23a,q24a,q25a,q29a" >

<EditFormSettings ColumnNumber="3" CaptionDataField="profileid" CaptionFormatString="Edit properties of profileid: {0}"
                        FormMainTableStyle-Font-Bold="true">
                        <FormTableItemStyle Wrap="true" />
                        <FormCaptionStyle CssClass="EditFormHeader" />
                        <FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="0" BackColor="#f0f2f4" Width="100%" />
                        <FormTableStyle GridLines="Horizontal" CellSpacing="0" CellPadding="2" BackColor="#f0f2f4" CssClass="module" Height="20px" 
                            Font-Size="Small" HorizontalAlign="Left" Font-Bold="true" Font-Names="Arial" />
                        <FormTableAlternatingItemStyle Wrap="true"  />
                        <FormStyle Width="100%" />
                        <EditColumn ButtonType="PushButton" UpdateText="Update" ItemStyle-Width="50px" UniqueName="EditCommandColumn1" 
                            CancelText="Cancel"  />
                        <FormTableButtonRowStyle HorizontalAlign="Left" />
                    </EditFormSettings>
<EditFormSettings ColumnNumber="3" CaptionDataField="profileid" CaptionFormatString="Edit properties of profileid: {0}"
                        FormMainTableStyle-Font-Bold="true">
                        <FormTableItemStyle Wrap="true" />
                        <FormCaptionStyle CssClass="EditFormHeader" />
                        <FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="0" BackColor="#f0f2f4" Width="100%" />
                        <FormTableStyle GridLines="Horizontal" CellSpacing="0" CellPadding="2" BackColor="#f0f2f4" CssClass="module" Height="20px" 
                            Font-Size="Small" HorizontalAlign="Left" Font-Bold="true" Font-Names="Arial" />
                        <FormTableAlternatingItemStyle Wrap="true"  />
                        <FormStyle Width="100%" />
                        <EditColumn ButtonType="PushButton" UpdateText="Update" ItemStyle-Width="50px" UniqueName="EditCommandColumn1" 
                            CancelText="Cancel"  />
                        <FormTableButtonRowStyle HorizontalAlign="Left" />
                    </EditFormSettings>
<EditFormSettings ColumnNumber="3" CaptionDataField="profileid" CaptionFormatString="Edit properties of profileid: {0}" FormMainTableStyle-Font-Bold="true">
<FormTableItemStyle Wrap="true" />
<FormCaptionStyle CssClass="EditFormHeader" />
<FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="0" BackColor="#f0f2f4" Width="100%" />
<FormTableStyle GridLines="Horizontal" CellSpacing="0" CellPadding="2" BackColor="#f0f2f4" CssClass="module" Height="20px" Font-Size="Small" HorizontalAlign="Left" Font-Bold="true" Font-Names="Arial" />
<FormTableAlternatingItemStyle Wrap="true"  />
<FormStyle Width="100%" />
<EditColumn ButtonType="PushButton" UpdateText="Update" ItemStyle-Width="50px" UniqueName="EditCommandColumn1" CancelText="Cancel"  />
<FormTableButtonRowStyle HorizontalAlign="Left" />
</EditFormSettings>



My codebehind validations are as below:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
    if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode))
    {
        GridEditableItem item = (GridEditableItem)e.Item;
        string[] arr_condition = { "q12a", "q13a", "q15a", "q23a", "q24a", "q25a", "q29a" };
        GridDropDownListColumnEditor editor;
        TableCell cell;
        foreach (string w in arr_condition)
        {
            editor = (GridDropDownListColumnEditor)item.EditManager.GetColumnEditor(w);
            cell = (TableCell)editor.DropDownListControl.Parent;
            RequiredFieldValidator validator = new RequiredFieldValidator();
            editor.DropDownListControl.ID = w + "_Required";
            validator.ControlToValidate = editor.DropDownListControl.ID;
            validator.InitialValue = "-1";
            validator.ErrorMessage = " *";
            cell.Controls.Add(validator);
        }
    }
}
 
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    string[] arr_condition = { "q12a", "q13a", "q15a", "q23a", "q24a", "q25a", "q29a" };
    if (e.Item is GridDataItem)
    {
        GridEditableItem item = (GridEditableItem)e.Item;
        item["q1"].Width = 100;
        foreach (string r in arr_condition)
        {
            if (item[r].Text == "Select")
            {
                item[r.Substring(0, 4)].Style["color"] = "red";
            }
        }
    }
 
    if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode))
    {
        GridEditableItem item = (GridEditableItem)e.Item;
        string[] arr_readonly = { "appid","proid","subid","q2","q3","q4","q5a","q5b","q5c","q5d","q5e","q6","q7",
 "q9a","q9b","q9c","q9d","q9e","q12a","q33","q34","q13a","q14","q16a_1","q16b_1","q16cd_1",
 "q16e_1","q17a_1","q17b_1","q17c_1","q17e_1","q18_1","q19a_1","q19b_1","q20a_1","q20b_1","q20c_1",
 "q21a_1","q22a_1","q22b_1","q15a","q16a_2","q16b_2","q16cd_2","q16e_2","q17a_2","q17b_2","q17c_2",
 "q17e_2","q18_2","q19a_2","q19b_2","q20a_2","q20b_2","q20c_2","q23a","q24a","q25a",
 "q26","q28","q29a","q30","q32"};
         
        TextBox temptxtbox;
        foreach (string w in arr_readonly)
        {
            temptxtbox = (TextBox)item[w].Controls[0];
            temptxtbox.Enabled = false;
            temptxtbox.Width = 250;
            temptxtbox.Height = 18;
            temptxtbox.Font.Size = 10;
        }
 
        RadDatePicker dt = (RadDatePicker)item["q1"].Controls[0];
        dt.Enabled = false;
        dt.Width = 250;
 
        DropDownList combobox;
        foreach (string r in arr_condition)
        {
            combobox = (DropDownList)item[r].Controls[0];
            if (combobox.SelectedItem.Text == "Select")
            {
                combobox.ForeColor = Color.Red;
            }
            combobox.Font.Bold = true;
            combobox.Font.Size = 12;
            combobox.Width = 240;
        }
 
        string[] arr_group2 = { "q15a","q16a_2","q16b_2","q16cd_2","q16e_2","q17a_2","q17b_2","q17c_2",
   "q17e_2","q18_2","q19a_2","q19b_2","q20a_2","q20b_2","q20c_2"};
        foreach (string w in arr_group2)
        {
            temptxtbox = (TextBox)item[w].Controls[0];
            temptxtbox.BackColor = Color.LightCyan;
        }
        combobox = (DropDownList)item["q15a_coded"].Controls[0];
        combobox.BackColor = Color.LightCyan;
    
}

I also tried using the trial version of the latest controls but the performance is the same.

Any help will be appreciated.

Thank you,
Parth

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 20 Dec 2010, 04:21 PM
Hello,

Please refer to the forum thread below for useful tips on how to optimize RadGrid performance.:
http://www.telerik.com/community/forums/aspnet-ajax/grid/slow-performance-when-using-bind.aspx

Kind regards,
Pavlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
Parth
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or