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

Conditional Formatting doesn´t aplly when GGC has autoformat = "Vista"


Hi,

I use a ggc which has an autoformat("Vista"), but, i use conditional formatting, my GGC doesn´t applies the format color.

In this sample, doesn´t has a autoformat feature.
http://samples.syncfusion.com/ASPNET/8.1.0.30/Web/Grid.Grouping.Web/samples/3.5/Appearance/ConditionalFormatting/cs/conditionalformatting.aspx?args=2

runat="server" DataMember="DefaultView" DataSourceCachingMode="ViewState" AutoFormat="None"
BorderCollapse="Separate" GroupDropAreaCssClass="GroupCss" ShowGroupDropArea="false">











This examples run it goods!. But, in my case, my GGC has an autoformat

EnableCallbacks="False" PostBackOnRowDblClick="False"
BorderColor="#2A437E" ShowIndicator="False"
DataSourceCachingMode="ViewState" DataMember="DefaultView" AutoFormat="Office 2007 Blue"
BorderCollapse="Separate" DragSelectionBackColor="Yellow"
HotTrackButtons="False" ClientSideOnRecordClick="fORC(this)" onbarbuttonitemclicked="GGC_BarButtonItemClicked"
PageSize="6" ReadOnly="true" onquerycellstyleinfo="GGC_QueryCellStyleInfo">

CS
--

protected void GGC_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{

if (e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell)
{
Record record = e.TableCellIdentity.DisplayElement.GetRecord();
if (e.TableCellIdentity.Column.Name == "EmployeeID")
{
int Result = 0;
if (record == null)
{
Result = 0;
}
else
{
Result = int.Parse(record.GetValue("EmployeeID").ToString());
}

if (Result < 3)
{
e.Style.CssClass = "MyGreenTextStyle";
e.Style.CellValue = Result.ToString() + " < 3";
//e.Style.BackColor = System.Drawing.Color.Green;
}
else if (Result > 2)
{
e.Style.CssClass = "MyGreenTextStyle";
e.Style.CellValue = Result.ToString() + " > 2";
//e.Style.BackColor = System.Drawing.Color.Yellow;
}
else if (Result == 0)
{
e.Style.CssClass = "MyGreenTextStyle";
e.Style.CellValue = Result.ToString() + " = 0";
//e.Style.BackColor = System.Drawing.Color.DarkRed;
}
}
}

}

css
---


.MyGreenTextStyle
{
background-color:Lime;
}


My GGC doesn't changes the background color.

References
----------
http://www.syncfusion.com/support/forums/grid-aspnet/72305/auto-format-and-grid-customization

Does anyone helps me, plz ?

Greeting !


5 Replies

JB Jaffersathick B Syncfusion Team March 4, 2010 06:26 AM UTC

Hi Ricardo,

Thank you for your interest in Syncfusion products.

We referred the forum which you mentioned as reference and found that your issue is resolved. Please let us know if you have any other concerns. We will be happy to help you out.

Regards,
Jaffer.B


RI Ricardo Ismael Sanchez Condori March 4, 2010 04:23 PM UTC


No, because, i have a GGC, and it has an autoformat = "Vista", i implemented a QueryCellStyleInfo, and applies an css, when its runs doesn't changes background color cell. i put my code above. I use 7.203.0.20. Do you have an example with this version ? because an example that you commented is for previous version, when i compiled the site, doesn't runns.

greeting y thnks !


JB Jaffersathick B Syncfusion Team March 8, 2010 04:13 AM UTC

Hi Ricardo,

Thank you for your interest in Syncfusion products.


We suggest you to set the e.Handled as true after applying the CSS class to the cell value. Please refer the code snippet below,


[CS]
if (Result < 3)
{
e.Style.CssClass = "MyGreenTextStyle";
e.Style.CellValue = Result.ToString() + " < 3";
e.Handled = true;
}



Due to security reason we are unable to provide you sample in public forums.

Let me know if you have any other queries.


Regards,
Jaffer.B


RI Ricardo Ismael Sanchez Condori March 9, 2010 05:48 PM UTC

well! that was what I needed e.Handled = true; in the solution above does not specify this. Greetings and thanks


JB Jaffersathick B Syncfusion Team March 12, 2010 03:40 AM UTC

Hi Ricardo,

Thanks for update.

We are glad to hear that your issue is resolved.

Please do not hesitate to get back to us for further assistance.

Regards,
Jaffer

Loader.
Live Chat Icon For mobile
Up arrow icon