Hi all,
I am using Infragistics 4 Version=11.1.20111.2064.
I am currently trying to apply a custom background image to a grid row cell based on some business logic.
I can do this successfully via a CSS class, but because the image is dynamically generated a static CSS class cannot be used.
How can I do this server-side when the grid row is initialised?
Addition:
In addition to the initial post.
Is it possible to create a css style during runtime and assign it to the
whdg cell?
Regards,
Tom
Hello Tom,
Thank you for contacting Infragistics support.
Please refer to the below article regarding styling WebDataGrid:
http://community.infragistics.com/blogs/engineering/archive/2010/08/25/webdatagrid-css-styling-guide.aspx
The same is valid regarding WHDG
You should specify CSS class and set it inside the InitializeRow event
tbody > tr.NewRowCssClass > td { background-color: Aqua !important; background-image: none; } protected void WebHierarchicalDataGrid1_InitializeRow(object sender, RowEventArgs e) { if (e.Row.Index == 1) { e.Row.CssClass = "NewRowCssClass"; } } If you want to add the styles runtime you should use the below approach:
tbody > tr.NewRowCssClass > td
{
background-color: Aqua !important;
background-image: none;
}
protected void WebHierarchicalDataGrid1_InitializeRow(object sender, RowEventArgs e)
if (e.Row.Index == 1)
e.Row.CssClass = "NewRowCssClass";
http://stackoverflow.com/questions/5362835/how-do-i-add-a-html-style-container-using-c
Let me know if you need further assistance.
Hi Tsvetelina,
Thank you for your reply.
However the suggestion by Infragistics is not valid, if you read my post in detail.
A static CssClass is not a solution as I have to allow for dynamic css classes during the grid initialisation.
I have however found a way to achieve what I want by using the Infragistics CssRegistry.
Thanks,
Thank you for the update.
I haven't read your second note, maybe you have added it later.
Yes you can achieve this using CSSRegistry.I will post the helpful links in order to share them with the community.
More about this feature in Taz's blog:
http://blogs.infragistics.com/blogs/taz_abdeali/archive/2009/04/15/application-wide-settings-for-asp-net-controls.aspx
Post of Magued:
http://community.infragistics.com/forums/p/46807/251014.aspx#251014