Click to See Complete Forum and Search --> : Gridview is Very slow on the Cells change event


vuyiswam
June 11th, 2009, 08:11 AM
Good Day all

i have a Ultrawebgrid i n my page and i display Data in this Way

STAFF CYCLES
=========================
Galloway A Ms 20,22,23,24,25,26
Gama, E 20,22,24,25
Grieve S Ms 20,25,26
Jones D Dr 24,26

and a user can select the Staff in the Grid by Holding a Control key and i have trapped the selection in the Gridstaff_SelectedCellsChange and handled it like this

protected void Gridstaff_SelectedCellsChange(object sender, SelectedCellsEventArgs e)
{
Change_Control_Availability_Cycles_Enable(); //Enable the Disabled button

List<String> Array_To_Be_Replaced = new List<String>(); //This are the Values to be replaced, they will be stored in this array

foreach (UltraGridCell cell in Gridstaff.DisplayLayout.SelectedCells)
{
if (cell.Column.Index == 0)
{

if (cell.Value != null && cell.Value.ToString() != "")
{
cell.Style.ForeColor = System.Drawing.Color.Red;

Array_To_Be_Replaced.Add(cell.Value.ToString());

}

}

else
{

}
}
Session["Array_To_Be_Replaced"] = Array_To_Be_Replaced;

}

Now when my user is selecting the Staff, this page becomes very Slow.

Can you please advice me on the approach and the Bottleneck in my code.

Thank you