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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

which event of Grid List Control can be used to change row color?

Thread ID:





17744 Aug 16,2004 03:42 AM UTC Aug 16,2004 02:58 PM UTC WinForms 3
Tags: GridControl
Asked On August 16, 2004 03:42 AM UTC

Hi, I have to change the color of a row to red in grid list control based on bound criteria. One more How can apply the format string to a column in this control. Thanks and Regards, Kalicharan Boorugu.

Administrator [Syncfusion]
Replied On August 16, 2004 05:29 AM UTC

I am not sure what you mean by bound criteria. But to change the backcolor of a row in a gridListConttrol, you can subscribe to gridListControl1.Grid.QueryCellInfo. There, if e.RowIndex points to the row you want to color, then set e.Style.BackColor to your color. As far as applying a format string to a column, you can use teh same QueryCellInfo event. If you set teh style.Fromat, you will also have to set teh style.CellValueType so the grid knows what type you are trying to format.
private void grid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
	if(e.RowIndex == 2 && e.ColIndex > 0)
		e.Style.BackColor = Color.Red;
	else if(e.RowIndex > 0 && e.ColIndex == 1)
		e.Style.Format = "##.##";
		e.Style.CellValueType = typeof(double);

Replied On August 16, 2004 01:09 PM UTC

I did the same way suggested. But when I am clicking on the grid it is not displaying anything in the grid. Strange problem, just a Mathematical Symbol with Triangles is getting displayed. What could be reason. This the code I have written. switch(e.ColIndex) { case 1: e.Style.Format = "HH00"; e.Style.CellValueType = typeof(System.DateTime); break; case 2: // if(Convert.ToInt32(glcViewAppts.Grid[e.RowIndex, 2].Text) < 1 ) // { // glcViewAppts.BeginUpdate(); // glcViewAppts.Grid[e.RowIndex, 1].BackColor = Color.Red; // glcViewAppts.EndUpdate(); // } break; }

Administrator [Syncfusion]
Replied On August 16, 2004 02:58 PM UTC

Here is a sample where it seems to be working ok for me. What are you doing differently? GridListControlSample_8439.zip


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon