I want to override the color property in my grid. i am using vs 2012 and mvc4.
Thanks & Regards,
Suman George
I am just checking the progress of this issue.
Please let me know if you have more questions regarding this topic.
Hello George,
In general, WebDataGrid is meant to be used in WebFroms context. I highly recommend using igGrid (http://es.infragistics.com/products/jquery/grid/) rather than WebDataGrid for MVC projects.
It is not clear to me, what is the color property you are referring to, so I would like to put a quick walkthrough regarding the styling for the WebDataGrid in general.
It is important to note - “WebDataGrid” uses CSS classes for styling its elements.
As example, you could change the color of the needed cell like this:
<style type="text/css">
tbody > tr > td.CellsStyle
{
background-color:Red;
}
style>
And in Code-Behind (InitializeRow event):
e.Row.Items(0).CssClass = "CellsStyle";
This code will change the background color of all cells in the first column to “Red”.
More about default css classes and styling of the “WebDataGrid” you can read here -http://community.infragistics.com/blogs/engineering/archive/2010/08/25/webdatagrid-css-styling-guide.aspx
I believe some of the following links should also be of use to you.
Change the row color based on condition:
http://es.infragistics.com/community/forums/p/87001/434538.aspx#434538
http://es.infragistics.com/community/forums/t/67944.aspx
More regarding how to change Cell Background Color in WebDataGrid at:
http://es.infragistics.com/community/forums/p/40418/307444.aspx
My suggestion is, if you want to use different style (custom style), use NetAdvantage AppStylist for ASP.NET. With this handful tool you can design CSS changes to a class and watch those changes be applied at the same time, and many other things.
Useful reference:
Getting to Know NetAdvantage AppStylist for ASP.NET
ASP.NET AppStyling Getting Started (video tutorial)
After you are done with your custom style, just use Infragistics Application Styling Configuration Tool to add libraries of consistently themed CSS files and graphic images to your project/web site.