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

Slow performance when using Bind

4 Answers 480 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Henrik
Top achievements
Rank 1
Henrik asked on 27 Feb 2009, 02:56 PM
Hi!

I have a radgrid which has a column that is always rendered in edit mode. The column is declared like this:
...
<
tel:GridTemplateColumn HeaderText="Tillægsværdi"  UniqueName="ShowTillaegProcent"
                            <EditItemTemplate> 
                                <tel:RadNumericTextBox ID="txtTillaegProcent" MinValue="0" MaxValue="100" DataType="System.Decimal" Type="Percent" DbValue='<%# Bind("TillaegProcent") %>' NumberFormat-DecimalDigits="2" Width="50" runat="server" /> 
                            </EditItemTemplate> 
                            <ItemTemplate> 
                                  <%# DataBinder.Eval(Container.DataItem, "TillaegProcent")%> 
                            </ItemTemplate> 
                        </tel:GridTemplateColumn>
...

Unfortunately, this makes the grid render very, very slowly. It takes approx. 30 seconds to render about 100 records. As soon as I remove the
DbValue='<%# Bind("TillaegProcent") %>' 
- the grid renders in "normal" time. The performance impact seems to be bigger in IE7 than FF3
How can this be? Is it bad practice to use the DbValue='# Bind.....' syntax?

Best regards

Henrik M Kristensen






4 Answers, 1 is accepted

Sort by
0
Accepted
Pavlina
Telerik team
answered on 02 Mar 2009, 02:25 PM
Hi Henrik,

We have a lot of optimization techniques for RadControls and I am sure some of them will be of great help for your project. Let me just go ahead and summarize the most important of them. If the info below does not help, please do not hesitate to provide some further details and send us a sample of your project where you experience the performance issues and we will gladly look into it.

First of all, I suggest you replace RadNumericTextBox with standard MS TextBox and use RadInputManager control to restrict the user input to numeric values only.

The main performance benefit which RadInputManager control has is related to the loading time of a large number of input controls on the page. The core of the performance benefit of using a RadInputManager as opposed to input controls, is in the following approach:

A normal input control generates a client side object for each control instance. For example, if you declare 300 input controls on the page, you will have 300 client objects, once the page is compiled and ran. On the other hand, when extending standard text boxes, via the RadInputManager control, you will have a single client side object, which would dramatically improve performance, while at the same time providing enhanced data entry capabilities for user input validation.

More information about RadInputManager is available in the following articles:
RadInputManager Performance
Dynamic Input Filter Settings

RadGrid

- data-binding: The .NET 2.0 version of the grid is optimized to handle up to 1 000 000 records without major performance problems. Server-side paging will increase performance dramatically.

    Example: http://www.telerik.com/DEMOS/ASPNET/Prometheus/Grid/Examples/Programming/CustomPaging/DefaultCS.aspx

    .NET 3.5 version can handle millions of records and will apply paging, sorting and filtering directly on the data-base server (LinqDataSource) codeless:

    http://blogs.telerik.com/vladimirenchev/Posts/08-03-10/How_fast_is_your_ASP_NET_DataGrid.aspx?ReturnURL=%2fvladimirenchev%2fposts.aspx%3fYear%3d2008%26Month%3d3

    Client-side data-binding approach is also very fast + you will get pure JSON transfer between client and server:

    http://blogs.telerik.com/VladimirEnchev/Posts/08-05-23/SQL_Server_sorting_paging_and_filtering_with_RadGrid_client-side_data-binding_to_WebService.aspx?ReturnURL=%2fVladimirEnchev%2fPosts.aspx

For more information about Optimization please refer to the following articles:
Optimizing output, page load time and the overall performance of RadControls for ASP.NET AJAX
How to optimize your performance?

Best regards,

Pavlina
the Telerik team

 


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Henrik
Top achievements
Rank 1
answered on 03 Mar 2009, 02:07 PM
Hi Pavlina,

Thanks a lot for the reply. Using the RadInputManager really did increase performance. Thanks a lot for the great answer!

Best regards

Henrik
0
Rogerick
Top achievements
Rank 1
answered on 09 Jul 2009, 08:14 PM
Hello,
    I'm using AJAX ASP.NET 2009 Q1.  I have a similiar RadGrid that is also editmode with RadNumericBoxes.  In addition to the RadNumericText Boxes, I have RadComboboxes that are in a edittemplate that has it's Text property being binded.  I'm assuming the radcomboxes being binded will have a performance issue.  If so, how can a speed up the performance of the radcombo box?

Thanks for your help,
Rogerick

Here's a code snippet:

<telerik:RadGrid ID="radgTest" runat="server"
 GridLines="None" Skin="Office2007" AllowMultiRowEdit="True"
        AutoGenerateColumns="False" Height="252px" style=" margin-bottom: 0px"  >
       
       
<MasterTableView  EditMode="InPlace"   ClientDataKeyNames="TEST_DEPT"
>
<RowIndicatorColumn>
<HeaderStyle Width="0px"></HeaderStyle>
</RowIndicatorColumn>

<ExpandCollapseColumn>
<HeaderStyle Width="35px"></HeaderStyle>
</ExpandCollapseColumn>
   <Columns>
       <telerik:GridTemplateColumn DataField="Z_FUND_CODE" HeaderText="Fund"
            SortExpression="Z_FUND_CODE" UniqueName="Z_FUND_CODE">
            <HeaderStyle Width="35px"></HeaderStyle>
            <EditItemTemplate>
                
                <telerik:RadComboBox ID="RadComboBoxFund" Runat="server" Skin="Office2007"
                    Width="225px" CollapseDelay="250" Height="225px"
                    onitemsrequested="RadComboBoxFund_ItemsRequested"
                    DataTextField="Z_FUND_CODE"   DataValueField="Z_FUND_CODE"
                     EnableLoadOnDemand="True"
                    Text='<%#DataBinder.Eval(Container.DataItem, "Z_FUND_CODE")%>'
                    CollapseAnimation-Duration="1" onprerender="RadComboBoxFund_PreRender">
                  <HeaderTemplate>
                     <div>
                     <table style="width: 225px"  cellspacing="0" cellpadding="0">
                         <tr>
                            <td style="width: 25px;" >
                              Fund Code
                            </td>
                            <td style="width: 200px;" >
                              Description
                            </td>
                         </tr>
                     </table>
                     </div>
                  </HeaderTemplate>
                 
                  <ItemTemplate>
                        <table style="width: 225px"  cellspacing="0" cellpadding="0">
                            <tr>
                                 <td style="width: 25px;" >
                                    <%#DataBinder.Eval(Container.DataItem, "Z_FUND_CODE")%>
                                 </td>
                                 <td style="width: 200px;" >
                                    <%#DataBinder.Eval(Container.DataItem, "DESCR")%>
                                 </td>
                            </tr>
                       </table>
                    </ItemTemplate>
                    
                    <CollapseAnimation Type="OutQuint" Duration="75"></CollapseAnimation>
                </telerik:RadComboBox>
                
            </EditItemTemplate>
            <ItemTemplate>
                <asp:Label ID="Z_FUND_CODELabel" runat="server" Text='<%# Eval("Z_FUND_CODE") %>'></asp:Label>
            </ItemTemplate>
        </telerik:GridTemplateColumn>
       <telerik:GridTemplateColumn DataField="RadVal1" DataType="System.Decimal"
             HeaderText="Wed" SortExpression="RadVal1" UniqueName="RadVal1">
            <HeaderStyle Width="35px"></HeaderStyle>
            <EditItemTemplate>
                <telerik:RadNumericTextBox ID="RadNumeric_RadVal1" Runat="server"
                    Text='<%# Bind("RadVal1") %>' IncrementSettings-Step="0"
                    IncrementSettings-InterceptArrowKeys="False"
                    IncrementSettings-InterceptMouseWheel="False" Width="35px"
                   MaxValue="99.99" MinValue="0" MaxLength="5">
                   <ClientEvents  OnValueChanged="OnClientValueChanged" />
                </telerik:RadNumericTextBox>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:Label ID="RadVal1Label" runat="server" Text='<%# Eval("RadVal1") %>'></asp:Label>
            </ItemTemplate>
        </telerik:GridTemplateColumn>
        <telerik:GridTemplateColumn DataField="RadVal2" DataType="System.Decimal"
            HeaderText="Thu" SortExpression="RadVal2" UniqueName="RadVal2">
            <HeaderStyle Width="35px"></HeaderStyle>
            <EditItemTemplate>
                <telerik:RadNumericTextBox ID="RadNumeric_RadVal2" runat="server"  Width="35px"
                    Text='<%# Bind("RadVal2") %>' IncrementSettings-Step="0" IncrementSettings-InterceptArrowKeys="False" IncrementSettings-InterceptMouseWheel="False"
                    > <ClientEvents  OnValueChanged="OnClientValueChanged" />
                    </telerik:RadNumericTextBox>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:Label ID="RadVal2Label" runat="server" Text='<%# Eval("RadVal2") %>'></asp:Label>
            </ItemTemplate>
        </telerik:GridTemplateColumn>

   </Columns>
</MasterTableView>
       
        
            <ClientSettings EnableRowHoverStyle="true">
               <Scrolling AllowScroll="True" UseStaticHeaders="true"/>
                <ClientEvents  OnGridCreated="GridCreated" OnRowCreated="RowCreated"></ClientEvents>
               
               
           </ClientSettings>
     
       
    </telerik:RadGrid>
          

..
0
Pavlina
Telerik team
answered on 10 Jul 2009, 11:04 AM
Hello,

RadComboBox control is far more complex than the standard dropdown it is expected to be slower as it uses much more built-in JS and skin resources to provide its advanced behavior. However, there are tips and tricks to make the combobox as fast as possible. Such a tip is using the Load On Demand feature that let you load an empty combobox when the page is first loaded. Then, the items can be added as the user types in the input field. This will definitely save loading time and will improve the combobox speed.

A sample implemenatation can be found in the KB article linked below:
http://www.telerik.com/support/kb/aspnet-ajax/combobox/using-radcombobox-with-autocomplete-as-a-custom-editor-in-radgrid.aspx

Regards,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Henrik
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Henrik
Top achievements
Rank 1
Rogerick
Top achievements
Rank 1
Share this question
or