Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
375
Grid Cell/Row backcolor
posted

Hi,

I have a grid binding to a UltraDataSource. The data source table is intially empty. It is populated/updated by incoming real time data. Upon receiving a real time message, I'll update the data source table, and some cells backcolor based on the cell data. Somehow, the cell backcolor is changed properly sometimes. Is there any problem in the way I update the data/grid?

public void OnRealTimeDataIn(string xmlMessage)

{

int iRowIndex = -1;

//Code to extract useful information from the incoming data

//......

foreach (UltraDataRow row in this.UltraDataSource1.Rows)

{

if (string.Compare(row.GetCellValue("ID").ToString(), sIDIn, true) == 0)

{

iRowIndex = row.Index;

break;

}

}

if (iRowIndex == -1)//data doesn't exist in the table

{

UltraDataRow newRow = this.UltraDataSource1.Rows.Add();

//assign data

//

iRowIndex = newRow.Index;

}

else

{

UltraDataRow exitingRow = this.UltraDataSource1.Rows[iRowIndex];

//update cell values, and its child band values

}

//Generate backcolor based on some algo

//Set cell back color

this.WinGird1.Rows[rowIndex].Cells["State"].Appearance.BackColor = clrBackColor;

}

 

The other question I have is that after sorting the gird by clicking on the column header, does the data in the ultradatasource gets sorted as well? e.g. dataA is at row1 in datasource table, after sort, it is displayed at row3 in grid, is it also at row3 in the data source table?

Thank you.