Optimizing Pages that use Telerik Controls. Mainly RadGrid

24. March 2010

Read this article in your language IT | EN | DE | ES

 

I was watching a webcast on Telerik TV, it’s called Optimizing RadGrid for ASP.NET Ajax.  There is a lot of useful information there. I summarized a bunch of it.

On my test page I…

  • Added Browserfile...
    • Compressing ViewState for RadTelerik controls  (Dropped viewstate considerably from sample page, 50,776 bytes to 5,428 bytes)
  • Added RadCompression for AJAX Calls to drop traffic size on ajax post-backs (Not handled by IIS compression)
  • Reduce Request using StyleManager and RadScriptManager
    • Added RadStyleSheetManager to MasterPage (Combines all CSS sheets into one download to limit requests)
    • Switched to RadScriptManager on Masterpage instead of ScriptManage
      • Request dropped from 71 to 47

 

Summarized Tips

  • Bind Grid Data on PreInit event, this will keep data from going to the ViewState and cut down on page size
  • If the Grid is ReadOnly and no editing takes place, then turn off viewstate for the Grid. EnableViewState="False"
    • Features that will NOT work when viewstate is off
      • Custom Edit Forms (User Control or Form Template)
      • Filtering
      • Grouping
      • Using Cached Data and Paging Together
    • Features that WILL work when view state is off
      • Indexes of Selected Items
      • Indexes of Edited Items
      • Group-by Expressions and Settings (but not the expanded state of grouped items)
      • Sort Expressions
      • Style Properties (But not if applied to a single cell or row in ItemDataBound event)
      • Column Order and other column properties
      • All settings concerning hierarchy structure (but not the expanded state of the items)
  • Optimized Column Editors on Grid
    • Used Shared Data Picker for Date columns in your grid
      • This requires a hidden data picker on page, and template column with textbox that uses js to talk to the datepicker with client-api (See Example Here)
    • Use Template column for comboxes and use Load-On-Demand
  • Ajaxify the Grid
    • Compresses Ajax calls which IIS misses, use RadCompression to drop traffic size
    • Use StyleManager and ScriptManager to bundle all css and scripts into one call each to server
  • More Tips Here
  • Other Ways to Optimize
    • Client-side Binding
    • Custom Paging
    • Virtual Scrolling
    • Caching Data server-side
    • Hierarchy Load modes
    • Group load modes
    • Filtering
    • .NET 3.5 + Linq
    • Upgrade from IE6

 

Other Controls

  • Other Controls
    • Use Shared Data Picker
    • Use RadInputManager if you want Validated or Stylized instead of using the the RadNumeric or RadTextbox controls
    • Use Load-On-Demand RadComboboxes
    • On RadMultiPage set RenderSelectedPageOnly = True
    • Hide Grid's with Visible="False" not with surrounding Div's set to display none.
      • Hiding the Grid itself, it doesn't render or get bound, grid will get data when visible is set to true again.
  • Add App_Browsers folder with a file that has.. (This one is HUGE, dropped my page significantly)
    • Create a file and add
    • <browsers>
          <browser refID="Default">
              <controlAdapters>
                  <!--<adapter controlType="System.Web.UI.Page" adapterType="Telerik.Web.UI.RadHiddenFieldPageStateCompression" />-->
                  <adapter controlType="System.Web.UI.Page" adapterType="Telerik.Web.UI.RadSessionPageStateCompression" />
              </controlAdapters>
          </browser>
      </browsers>

Telerik, AJAX, ASP.NET , , ,