Discussion:
How to change the list row color based on the value of the list it
(too old to reply)
sasi kanth paritala
2007-10-15 12:20:01 UTC
Permalink
hi could any one help me regarding this ,i have a list and in that list i
have a numeric field based on the field value i have to display color of the
row,
for example if value ranges 1-10 i have to render red color if value 11-20 i
have to render green....
g***@gmail.com
2007-10-16 01:54:21 UTC
Permalink
On Oct 15, 8:20 am, sasi kanth paritala <sasi kanth
Post by sasi kanth paritala
hi could any one help me regarding this ,i have a list and in that list i
have a numeric field based on the field value i have to display color of the
row,
for example if value ranges 1-10 i have to render red color if value 11-20 i
have to render green....
I think you need to use a data view web part for this, or roll your
own grid using the spgridview (or something like that).

--Paul Galvin
Sundar Narasiman
2007-10-18 13:07:01 UTC
Permalink
Sasikanth Paritala,

As paul galvin said, you can leverage DataViewWebPart to accomplish this
task. You need to edit this
list in the SharePoint designer and then manipulate the XSLT's to achive the
formatting you had asked for. I've done a similar kind of work for my client
--
----
Thanks,
Sundar Narasiman,
Blog: http://dotnetbuzz.spaces.live.com/
My Request: Please rate posts in Microsoft Newsgroups and Forums genuinely.
This would encourage helpful volunteers.
Post by g***@gmail.com
On Oct 15, 8:20 am, sasi kanth paritala <sasi kanth
Post by sasi kanth paritala
hi could any one help me regarding this ,i have a list and in that list i
have a numeric field based on the field value i have to display color of the
row,
for example if value ranges 1-10 i have to render red color if value 11-20 i
have to render green....
I think you need to use a data view web part for this, or roll your
own grid using the spgridview (or something like that).
--Paul Galvin
sasi kanth paritala
2007-10-16 06:24:00 UTC
Permalink
hi paul,

i checked to develop our own custom control but it is also not possible i
think because it is sealed class so we cant inherit that ,so is there any way.
Post by sasi kanth paritala
hi could any one help me regarding this ,i have a list and in that list i
have a numeric field based on the field value i have to display color of the
row,
for example if value ranges 1-10 i have to render red color if value 11-20 i
have to render green....
Sundar Narasiman
2007-10-19 09:13:36 UTC
Permalink
sasi kanth paritala,

You don't need to create custom controls using API's. You can create
DataViewWeb Part with the help of SharePoint Desinger 2007 (If you are using
WSS 3.0/MOSS 2007) / MS Front Page 2003 (if you are using WSS 2.0/ SPS 2003).

Please download the document from the following url

http://www.sharepointcustomization.com/resources/whitepapers/webpartdocs/dataview_wp.doc

This has step-by-step instruction fo how to create DataView WebPart to
render the list items with XSLT Formatting.

Once you've created the DataViewWebPart, you can manipulate the XSLT to
render the way you want the formatting ((( for example if value ranges 1-10 i
have to render red color if value 11-20 i have to render green....))

This should answer your question
--
----
Sundar Narasiman,
http://dotnetbuzz.spaces.live.com/
Post by sasi kanth paritala
hi paul,
i checked to develop our own custom control but it is also not possible i
think because it is sealed class so we cant inherit that ,so is there any way.
Post by sasi kanth paritala
hi could any one help me regarding this ,i have a list and in that list i
have a numeric field based on the field value i have to display color of the
row,
for example if value ranges 1-10 i have to render red color if value 11-20 i
have to render green....
SirCodesALot
2007-10-30 20:48:49 UTC
Permalink
On Oct 15, 7:20 am, sasi kanth paritala <sasi kanth
Post by sasi kanth paritala
hi could any one help me regarding this ,i have a list and in that list i
have a numeric field based on the field value i have to display color of the
row,
for example if value ranges 1-10 i have to render red color if value 11-20 i
have to render green....
You could also do this on the client side after the page is rendered
with Javascript. Here is an example:

<script>

function addColor()
{
//that big long number can be found in the source of the page
var wp_table = document.getElementById("{313FACC2-BA49-442A-B345-
F7C207C43CC0}-{6215639C-079D-4898-8C63-334AC30882E9}");
var switchColumn = 1;

if (wp_table != null)
{
var tbody = wp_table.childNodes[0];
var trs = tbody.childNodes;
for (var i=1;i<trs.length;i++)
{
var tdVal = trs[i].childNodes[switchColumn].innerHTML;

switch (tdVal)
{
case "1" : trs[i].style.background = "#00FF99";
break;
case "2" : trs[i].style.background = "#FFF99";
break;
default:
}
}
}
}

window.onload = addColor();

</script>

I havent tested this code, but you get the idea. Add this in a content
editor webpart.
Ethan Bach
2010-10-01 10:56:17 UTC
Permalink
The most common way to do that is by using SharePoint Designer. with SPD you convert the list to xslt view(actually it converted to data view). Then you can set a conditional formatting rules.
To do that you'll need SharePoint Designer which you can download for free from MS. And you'll need at least a designer permission on your web. Sometimes using this can break your view ( if you have grouping an sorting).

One other way, is to use 3rd party Add-On. We have a color field that you can check out that does the same just without hassle with SharePoint Designer problems.
Check it out at - http://www.infowisesolutions.com/product.aspx?id=ColorField

Ethan
http://www.Infowisesolutions.com
Post by sasi kanth paritala
hi could any one help me regarding this ,i have a list and in that list i
have a numeric field based on the field value i have to display color of the
row,
for example if value ranges 1-10 i have to render red color if value 11-20 i
have to render green....
Post by g***@gmail.com
I think you need to use a data view web part for this, or roll your
own grid using the spgridview (or something like that).
--Paul Galvin
Post by sasi kanth paritala
hi paul,
i checked to develop our own custom control but it is also not possible i
think because it is sealed class so we cant inherit that ,so is there any way.
Post by Sundar Narasiman
Sasikanth Paritala,
As paul galvin said, you can leverage DataViewWebPart to accomplish this
task. You need to edit this
list in the SharePoint designer and then manipulate the XSLT's to achive the
formatting you had asked for. I've done a similar kind of work for my client
--
----
Thanks,
Sundar Narasiman,
Blog: http://dotnetbuzz.spaces.live.com/
My Request: Please rate posts in Microsoft Newsgroups and Forums genuinely.
This would encourage helpful volunteers.
Post by Sundar Narasiman
sasi kanth paritala,
You don't need to create custom controls using API's. You can create
DataViewWeb Part with the help of SharePoint Desinger 2007 (If you are using
WSS 3.0/MOSS 2007) / MS Front Page 2003 (if you are using WSS 2.0/ SPS 2003).
Please download the document from the following url
http://www.sharepointcustomization.com/resources/whitepapers/webpartdocs/dataview_wp.doc
This has step-by-step instruction fo how to create DataView WebPart to
render the list items with XSLT Formatting.
Once you've created the DataViewWebPart, you can manipulate the XSLT to
render the way you want the formatting ((( for example if value ranges 1-10 i
have to render red color if value 11-20 i have to render green....))
This should answer your question
--
----
Sundar Narasiman,
http://dotnetbuzz.spaces.live.com/
Post by SirCodesALot
On Oct 15, 7:20 am, sasi kanth paritala <sasi kanth
You could also do this on the client side after the page is rendered
<script>
function addColor()
{
//that big long number can be found in the source of the page
var wp_table = document.getElementById("{313FACC2-BA49-442A-B345-
F7C207C43CC0}-{6215639C-079D-4898-8C63-334AC30882E9}");
var switchColumn = 1;
if (wp_table != null)
{
var tbody = wp_table.childNodes[0];
var trs = tbody.childNodes;
for (var i=1;i<trs.length;i++)
{
var tdVal = trs[i].childNodes[switchColumn].innerHTML;
switch (tdVal)
{
case "1" : trs[i].style.background = "#00FF99";
break;
case "2" : trs[i].style.background = "#FFF99";
break;
}
}
}
}
window.onload = addColor();
</script>
I havent tested this code, but you get the idea. Add this in a content
editor webpart.
Submitted via EggHeadCafe - Software Developer Portal of Choice
Freeze Row Group Header in WPF DataGrid
http://www.eggheadcafe.com/tutorials/aspnet/98891749-f30a-4cbe-b711-dcaaee52bef3/freeze-row-group-header-in-wpf-datagrid.aspx
Continue reading on narkive:
Loading...