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. (Last updated on: November 16, 2018).
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:

Created:

Updated:

Platform:

Replies:

17744 Aug 16,2004 03:42 AM UTC Aug 16,2004 02:58 PM UTC WinForms 3
loading
Tags: GridControl
kalicharan
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);
	}
}
                
            

kalicharan
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

CONFIRMATION

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.

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

;