Batch update gridview cells value

3 posts, 1 answers
  1. Anu
    Anu avatar
    8 posts
    Member since:
    May 2011

    Posted 12 Sep 2011 Link to this post

    is there a way to batch update cell value of a gridview.

    I have a situation where i have to loop thru each row and then update one cell value, as shown below. But it becomes really slow when i have large number of records on the grid, so is there any batch update that can be applied. My interface is with a textbox field above the grid and when the user enter text and press apply it has to apply that text to all records on the grid (it could be 100 - 10000 reocords on the grid depending one the search)
    foreach (GridViewRowInfo row in radGV_.Rows)
           {
               row.Cells["BName"].Value = txtBName.Text;
           }

  2. Answer
    Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 14 Sep 2011 Link to this post

    Hello anu,

    Please add a gridView.BeginUpdate() ... gridView.EndUpdate() or
    using (gridView.DeferRefresh()
    {
           foreach (GridViewRowInfo row in radGV_.Rows)
           {
               row.Cells["BName"].Value = txtBName.Text;
           }
    }

    Best Regards,
    Emanuel Varga
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Alexander
    Admin
    Alexander avatar
    306 posts

    Posted 15 Sep 2011 Link to this post

    Hello Anu,

    Thank you for the solution, Emanuel.

    Indeed, the DeferRefresh method of RadGridView can be used to create a batch update. It should improve the performance of the update operation.

    Best regards,
    Alexander
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top