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.
Syncfusion Feedback

Auto format and grid customization

Thread ID:

Created:

Updated:

Platform:

Replies:

72305 Mar 13,2008 12:00 AM UTC Mar 4,2010 06:19 AM UTC ASP.NET Web Forms (Classic) 4
loading
Tags: GridGroupingControl
Dave
Asked On March 13, 2008 12:00 AM UTC

I would like to use one of the themes provided through Auto Format and then I would like to change properties of cells at runtime. (I.e. change cell background color based on value in another cell). Unfortunately, I have only been able to get this to work when I turn "Auto Format" off. I am new to this and would appreciate your help. I imagine the Auto Format is getting applied after the execution of the following:

protected void GridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.AnyRecordFieldCell)
{
if ((e.TableCellIdentity.Column.Name == "division") && (e.Style.CellValue.ToString() == "MTD"))
{
e.Style.BackColor = System.Drawing.Color.Red;
}
}
}






Administrator [Syncfusion]
Replied On March 14, 2008 06:38 AM UTC

Hi Dave,

Thank you for your interest in Syncfusion Products.

You have to override the autoformat in order to change properties of cells at runtime. Please use below code snippet to achieve this:



[C#]

protected void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.AnyRecordFieldCell)
{
if ((e.TableCellIdentity.Column.Name == "Header0") && (e.Style.CellValue.ToString() == "2,0"))
{
//Override autoformat
e.Style.CssClass = "MyGreenTextStyle";
}
}

}

[CSS]

.MyGreenTextStyle
{
background-color:Lime;
}




Please refer the sample in the below link which illustrates the above:

http://websamples.syncfusion.com/samples/Grid.Web/6.1.0.34/72305/main.htm

Please try this and let me know if this helps.

Thanks,
Melba





Ricardo Ismael Sanchez Condori
Replied On March 3, 2010 08:34 PM UTC


Hi,

the link is broken, the correct link please.

Greetings and thnks

Ricardo Ismael Sanchez Condori
Replied On March 3, 2010 10:39 PM UTC


Jaffersathick B [Syncfusion]
Replied On March 4, 2010 06:19 AM UTC

Hi Ricardo,

Thank you for your interest in Syncfusion products.

We glad to know that you found the correct link. Please let us know if you have any other concerns. We will be happy to help you out.

Regards,
Jaffer.B

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

;