Click here to Skip to main content
15,886,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello everyone!

There is a problem everyone would help.

In ASP.NET you want to display column color by number, while increasing the number of colors in the column increases.

illustrations:

http://www.cuocsongso.com/forum/attachment.php?attachmentid=11461&d=1302169075[^]

Please guide source
Posted
Updated 20-Apr-11 5:09am
v2
Comments
R. Giskard Reventlov 20-Apr-11 11:17am    
Your question makes no sense: rephrase.
Sandeep Mewara 20-Apr-11 12:07pm    
Not clear... please edit and update it.
thatraja 20-Apr-11 13:26pm    
I think you want to increase colors while column increases. make it clear. Give us a detailed explanation.
[no name] 20-Apr-11 13:47pm    
I believe you are talking about creating a color gradient. Please clarify your question

1 solution

Hi as per the image you have shown looks like a bar chart. That can be achieved using a Text or Label controls inside a Item template.

1) Have a Item Template column. Inside that have a textbox control/ DIV element packed inside a DIV element.
2) Set the background of the textbox to the desired color.
3) At RowDatabound event of the gridview convert your value to percentage. The max value is 100% and scale other values using the max value as denominator.

4) Calculate the percentage of length using the percentage you calculated earlier. For example your textbox/ div width is 60px and your value is 35 percent then the new width= (35/100)*60. Assign this new width to the textbox or the div element. For zero value if the width is not assigned as zero then change the background color to white.

Hope this helps
 
Share this answer
 
Comments
Sandeep Mewara 27-Apr-11 12:09pm    
Nicely exaplained and directed. 5!
Albin Abel 27-Apr-11 12:16pm    
Thanks Sandeep

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900