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.

Conditional Formatting - Entire row, based in one specific field

Thread ID:

Created:

Updated:

Platform:

Replies:

118986 May 1,2015 10:52 AM May 4,2015 06:28 AM ASP.NET Web Forms 1
loading
Tags: Grid
Henrique
Asked On May 1, 2015 10:52 AM

Hi,

I have a field with three possible values : 
0 - Not checked
1 - Approved
2 - Not approved

I want to change the entire row color base on this values, like this:
0 - Default
1 - Green
2 - Red

I searched, but again I didn't found anything in the online documentation.

Is there a way to do this?
If the answer is yes, I always prefer server-side events code, send-me a solution in javacript only if there is not a solution for the server-side code.

Thanks again, you guys are awesome.

Regards

Henrique

Balaji Marimuthu [Syncfusion]
Replied On May 4, 2015 06:28 AM

Hi Marcelo,

Thanks for using Syncfusion Products.

We have analyzed and a created sample for your requirement. Please find the sample and the code snippet.
Sample: Sample.zip

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">


<div>

<ej:Grid ID="Grid" runat='server' AllowPaging="true" >

<ClientSideEvents QueryCellInfo="querycellinfo" />

</ej:Grid>

</div>

</asp:Content>


<asp:Content runat="server" ID="Content1" ContentPlaceHolderID="ScriptSection">

<script>

function querycellinfo(args) {

if (args.column.field == "Number" && args.data.Number == 1)

$($(args.cell).parent()).css("backgroundColor", "Green");/*custom css applied to the row */

if (args.column.field == "Number" && args.data.Number == 2)

$($(args.cell).parent()).css("backgroundColor", "Red");/*custom css applied to the row */

}

</script>
</asp:Content>



We would like to let you know that we can’t apply the background color to the row base on the values in server side. But we can change the rows background color based on the values by using “QueryCellInfo” client side event. So we suggest you to use the client side event “QueryCellInfo” to achieve your requirement.

Please refer the online documentation for further details.
Documentation: http://www.syncfusion.com/kb/2979/how-to-select-or-highlight-rows-based-on-data


Please let us know if you have any queries.

Regards,
Balaji Marimuthu

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.

;