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

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

Thread ID:

Created:

Updated:

Platform:

Replies:

17744 Aug 15,2004 11:42 PM Aug 16,2004 10:58 AM Windows Forms 3
loading
Tags: GridControl
kalicharan
Asked On August 15, 2004 11:42 PM

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 01:29 AM

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 09:09 AM

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 10:58 AM

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.

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.

;