We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Refreshing Row/Column styles

Hi, Is it possible to force a refresh (requery) of a row/column styles for a virtual grid without calling ResetVolitileData? For example, I'm updating my internal data for a column's style, I call InvalidateRange on a Column Range for that column, but only individual cell QueryCellInfo calls are made, not for the column. (I want a QueryCellInfo event with e.ColIndex = mycolumn and e.RowIndex = -1). Thanks, Sue

6 Replies

AD Administrator Syncfusion Team May 8, 2003 06:58 AM UTC

As a matter of fact, you can provide the column styles dynamically in QueryCellInfo by checking for e.RowIndex == -1.
//set column style 2
if(e.ColIndex == 2 && e.RowIndex == -1)
{
	e.Style.BackColor = Color.LightGoldenrodYellow;
}
Is it not working for you?


SH Sue Harris May 8, 2003 06:50 PM UTC

Thats right, I'm providing all my styles dynamically via the QueryCellInfo. I initially set a style to something (for example LightGoldenrodYellow color) and then when the user does something else (clicks a button for example) I want to change that style, but I can't get the QueryCellInfo to refire with the -1 row index.


AD Administrator Syncfusion Team May 8, 2003 08:16 PM UTC

Calling grid,Refresh() seemed to work for me in these code snippets.
Color c = Color.LightGoldenrodYellow;

private void button1_Click(object sender, System.EventArgs e)
{
	c = Color.LightBlue;
	this.gridControl1.Refresh();
}

private void gridControl1_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
	if(e.RowIndex == -1  && e.ColIndex == 1)
		e.Style.BackColor = c;
}


SH Sue Harris May 8, 2003 08:44 PM UTC

Clay, That is exactly what I want to happen but its not happening for me. I've attached a simple sample, which started as your virtual grid sample. I added a checkbox and in the CheckChanged event I call grid.Refresh. But I'm not getting a QueryCellInfo call with a -1 row count. Please tell whats going wrong. Thanks Sue


AD Administrator Syncfusion Team May 8, 2003 09:06 PM UTC

Sue, Your code works for me. Now I am running 1.0 FrameWork so I had to change the proj and sln files a little to get things to run. I am also using teh 1.6.0.1 beta code. But I see the text color change from green to pink and back again as I click the button. What version are you using? If you want to try the 1.6.0.1 beta, you can submit a Direct Trac support incident and I can send you a download link. Clay


SH Sue Harris May 14, 2003 12:33 AM UTC

Thanks Clay, The 1.6 beta works perfectly.

Loader.
Live Chat Icon For mobile
Up arrow icon