Showing posts with label color. Show all posts
Showing posts with label color. Show all posts

Monday, March 19, 2012

Group Header Alternating color

I am trying to get alternating colors on group headers.

The rownumber() doesn't work; that only seems to be the count of rows in the group.

Does anyone have any great ideas for this?

Thanks!

BobP

Have you tried CountDistinct(<group expression fields>)?|||

Yes, I get a "1" for each group header row.

I have also tried countrows.

BobP

|||I realize this was a year ago, but was wondering if anyone had figured out a solution. I am trying to alternate colors at the group level and am not having any luck...
|||

If I understand you correctly, this should give you the desired result:

Add this to your code window:

Code Snippet

Dim numFooterRow as Double

Function GetRowNumber() as Double
numFooterRow += 1
Return numFooterRow
End Function

Add a new column to the table and mark it as not visible. On the group header row (the invisible column), add this expression:

Code Snippet

=Code.GetRowNumber()

You will need the name of the textbox that you just entered the expression into for the final part. In the header row background color add the following expression:

Code Snippet

=iif(ReportItems!textbox18.Value Mod 2 = 0,"LightCoral","RosyBrown")

You now have alternating colors at the group header level.

Simone

|||Wow, thanks so much, Simone! I've been banging my head against the wall on this one for the last hour, trying to think up ways to do it in SQL, using the Previous() function, etc. This worked like a charm!
|||I am trying to do something where I say look through the row. When you come across the word "Start" color that box green and color all other boxes to the right in that row green as well until you come upon the word "stop". Is this possible? If I am not making sense just let me know and I will try to explain better. Thanks in advance for any help that I get.|||You might want to start a new thread, although somewhat similar, it seems to me its a different topic...|||Ok will do.

Group Header Alternating color

I am trying to get alternating colors on group headers.

The rownumber() doesn't work; that only seems to be the count of rows in the group.

Does anyone have any great ideas for this?

Thanks!

BobP

Have you tried CountDistinct(<group expression fields>)?|||

Yes, I get a "1" for each group header row.

I have also tried countrows.

BobP

|||I realize this was a year ago, but was wondering if anyone had figured out a solution. I am trying to alternate colors at the group level and am not having any luck...
|||

If I understand you correctly, this should give you the desired result:

Add this to your code window:

Code Snippet

Dim numFooterRow as Double

Function GetRowNumber() as Double
numFooterRow += 1
Return numFooterRow
End Function

Add a new column to the table and mark it as not visible. On the group header row (the invisible column), add this expression:

Code Snippet

=Code.GetRowNumber()

You will need the name of the textbox that you just entered the expression into for the final part. In the header row background color add the following expression:

Code Snippet

=iif(ReportItems!textbox18.Value Mod 2 = 0,"LightCoral","RosyBrown")

You now have alternating colors at the group header level.

Simone

|||Wow, thanks so much, Simone! I've been banging my head against the wall on this one for the last hour, trying to think up ways to do it in SQL, using the Previous() function, etc. This worked like a charm!
|||I am trying to do something where I say look through the row. When you come across the word "Start" color that box green and color all other boxes to the right in that row green as well until you come upon the word "stop". Is this possible? If I am not making sense just let me know and I will try to explain better. Thanks in advance for any help that I get.|||You might want to start a new thread, although somewhat similar, it seems to me its a different topic...|||Ok will do.

Group Header Alternating color

I am trying to get alternating colors on group headers.

The rownumber() doesn't work; that only seems to be the count of rows in the group.

Does anyone have any great ideas for this?

Thanks!

BobP

Have you tried CountDistinct(<group expression fields>)?|||

Yes, I get a "1" for each group header row.

I have also tried countrows.

BobP

|||I realize this was a year ago, but was wondering if anyone had figured out a solution. I am trying to alternate colors at the group level and am not having any luck...
|||

If I understand you correctly, this should give you the desired result:

Add this to your code window:

Code Snippet

Dim numFooterRow as Double

Function GetRowNumber() as Double
numFooterRow += 1
Return numFooterRow
End Function

Add a new column to the table and mark it as not visible. On the group header row (the invisible column), add this expression:

Code Snippet

=Code.GetRowNumber()

You will need the name of the textbox that you just entered the expression into for the final part. In the header row background color add the following expression:

Code Snippet

=iif(ReportItems!textbox18.Value Mod 2 = 0,"LightCoral","RosyBrown")

You now have alternating colors at the group header level.

Simone

|||Wow, thanks so much, Simone! I've been banging my head against the wall on this one for the last hour, trying to think up ways to do it in SQL, using the Previous() function, etc. This worked like a charm!
|||I am trying to do something where I say look through the row. When you come across the word "Start" color that box green and color all other boxes to the right in that row green as well until you come upon the word "stop". Is this possible? If I am not making sense just let me know and I will try to explain better. Thanks in advance for any help that I get.|||You might want to start a new thread, although somewhat similar, it seems to me its a different topic...|||Ok will do.

Group Format

Hi,
I want to set my group's background to different color. something like
Group1
[Group1-A] [BGColor=Blue]
[Group1-B] [BGColor=Green]
[Group1-C] [BGColor=Red]
Group2
[Group2-A] [BGColor=Blue]
[Group2-B] [BGColor=Green]
[Group2-C] [BGColor=Red]
any clue ?You can use an expression to set the group's background color. You have two
choices: iif() or swtich().
The iif() syntax is a resonable choice when there are a couple of options.
Switch() will be easier if you have a large number of options.
=iif(Fields!<FieldName.Value> = "Value1", "Green", "Blue")
=Switch(Fields!<FieldsName>.Value = "Value1", "Green",
Fields!<FieldsName>.Value = "Value2", "Blue", ...)
--
Bruce Johnson [MSFT]
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Ameet" <Ameet@.discussions.microsoft.com> wrote in message
news:1008088F-1FC6-4625-9C1A-EF4096D0FB0C@.microsoft.com...
> Hi,
> I want to set my group's background to different color. something like
> Group1
> [Group1-A] [BGColor=Blue]
> [Group1-B] [BGColor=Green]
> [Group1-C] [BGColor=Red]
> Group2
> [Group2-A] [BGColor=Blue]
> [Group2-B] [BGColor=Green]
> [Group2-C] [BGColor=Red]
> any clue ?

Sunday, February 19, 2012

Group ..Alternate color ....Help Needed!

Hi,
I'm using the following in the colorbackground of the group header
to change the color of the group when a group name changes.
=iif(RowNumber("DTM_Group1")Mod 2, "White", "Cornsilk")
But this is not working properly when the group name changes!
Could some one help me with this?groupname changes ? means ?
"c4raj" wrote:
> Hi,
> I'm using the following in the colorbackground of the group header
> to change the color of the group when a group name changes.
> =iif(RowNumber("DTM_Group1")Mod 2, "White", "Cornsilk")
> But this is not working properly when the group name changes!
>
> Could some one help me with this?
>|||I have created a Group by name DTM_Group1 in the table.
Whenever the value in the DTM_Group1 changes, I want the color should
be changed.
Just like alternate coloring the rows, I want the color to be changed
on the group.|||Try this instead:
=iif(RowNumber("DTM_Group1") Mod 2 = 0, "White", "Cornsilk")
"c4raj" wrote:
> Hi,
> I'm using the following in the colorbackground of the group header
> to change the color of the group when a group name changes.
> =iif(RowNumber("DTM_Group1")Mod 2, "White", "Cornsilk")
> But this is not working properly when the group name changes!
>
> Could some one help me with this?
>|||Try with RowNumber(Nothing) / ROwNumber()|||Tried... No luck!

gridview

iam taking first value of label and comparing with rest of values if it is same then i want to change the color of that row.
but what is happening is entire gridview backcolor is changing to red.

i want to change only those rows which matches.

void GridView1_DataBound(object sender, EventArgs e)
{
foreach (GridViewRow gv in GridView1.Rows)
{

Label lbl = (Label)gv.Cells[2].Controls[0].FindControl("Label1");
string t = lbl.Text;
for (int i = 0; i < GridView1.Rows.Count; i++)
{
Label lbl4 = (Label)GridView1.Rows[i].Cells[2].Controls[0].FindControl("Label1");
if (t == lbl4.Text)
{
GridView1.Rows[i].Cells[2].BackColor = System.Drawing.Color.Red;

//gv.BackColor = System.Drawing.Color.Red;

}

}

}

}Please, move this to appropriate forum.