RadGridView initialization delay

2 posts, 0 answers
  1. Raymond
    Raymond avatar
    134 posts
    Member since:
    Jul 2010

    Posted 12 Jun 2012 Link to this post

    Could I make RadGridView control's initialization faster? Currently first initialization of this control can take few seconds, what is quite long in case of dialog window, appearing on demand.

    Sample code:

    public partial class RadGridViewDialog : Form
        private RadGridView _grid;
        public RadGridViewDialog()
        private void btnInitialize_Click(object sender, EventArgs e)
            _grid = new RadGridView();
            _grid.Dock = DockStyle.Fill;
        private void btnBuild_Click(object sender, EventArgs e)
            using (_grid.DeferRefresh())
                GridViewDataColumn firstColumn = new GridViewTextBoxColumn();
                firstColumn.HeaderText = "Name";
                firstColumn.ReadOnly = true;
                GridViewDataRowInfo[] rows = new GridViewDataRowInfo[200];
                GridViewDataColumn secondColumn = new GridViewTextBoxColumn();
                secondColumn.HeaderText = "Value";
                secondColumn.Width = 110;
                secondColumn.MinWidth = 70;
                int rowIndex = 0;
                for (int i = 0; i < rows.Length; i++)
                    rows[rowIndex] = new GridViewDataRowInfo(_grid.MasterView);
                    rows[rowIndex].Cells[0].Value = "name" + i;
                    rows[rowIndex].Cells[1].Value = "value" + i;
                firstColumn.IsPinned = true;

    After first opening this form, when user clicks on btnInitialize button application is freezing for few seconds, clicking on btnBuild button is much faster. Second and next clicks on btnInitialize (no matter in the same or other dialog in the same application) are faster too.

    I've noticed that it's a reason of calling:
    in the static constructor of class Telerik.WinControls.UI.RadGridViewElement.

    Is it possible to speed up first initialization of this class?

  2. Stefan
    Stefan avatar
    2908 posts

    Posted 13 Jun 2012 Link to this post

    Hi Raymond,

    Thank you for writing.

    When loading a control from our suite for first time the themes are loaded too and this causes the observed delay. Unlike the default WinForms controls our suite offers animations and themes and loading them takes its time. This time increases when using a lot of controls like in your application. Once the themes are loaded the startup time is improves, as you noticed in subsequent loading of the grid.

    The following KB articles summarize ways to optimize an application with our controls:

    Another thing that you can do is to initialize the grid in the RadGridViewDialog's constructor, so the initial loading time will be moved to the form opening and then when you press the Initialize button it will add the grid faster.

    I hope that the provided information addresses your questions. Let us know if you have any additional inquiries. 
    All the best,
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Back to Top