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

Batch update gridview cells value

2 Answers 62 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Anu
Top achievements
Rank 1
Anu asked on 12 Sep 2011, 08:43 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 14 Sep 2011, 07:38 AM
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
0
Alexander
Telerik team
answered on 15 Sep 2011, 09:13 AM
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 >>

Tags
GridView
Asked by
Anu
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Alexander
Telerik team
Share this question
or