Reputation: 11
How to get different background color in alternate columns in a table in ssrs? We know how to get diff BG color in Alternate rows but not sure about alternate columns
Upvotes: 1
Views: 4995
Reputation: 1541
in tablix add new column at last & set the name of textbox to 'Rownumber' & set value of textbox as expression
=RunningValue(Fields!PrimaryColumnName.Value, CountDistinct, "DataSet1")
change PrimaryColumnName & dataset1 based on you have in your report
now select tablix row & set expression for background color to
=iif(ReportItems!Rownumber.Value Mod 2=1,"#dddddd","White")
change color code & name based on requirement .. at last hide newly added column 'Rownumber' from tablix
learn about RunningValue
Above work for alternate rowcolor
for alternate column color, we have to add some custom code & then use that on every column
dim Counter as integer=1
Public function getCounter() as Integer
Counter=Counter+1
return Counter
end function
now use/set background expression on each column like
=iif(code.getCounter Mod 2=1,"#dddddd","White")
Upvotes: 3