开发者

MS Reporting services - How to pass cell color

I am trying to create a report that has some data values. Each data value can be of a 'good' or 'bad' quality. I would like to pass a value color through the dataset using a custom C# data provider object. Once in the report designer, I can use 'F开发者_运维问答ields!MyColumn.Value' and it works fine. There is also an option to type 'Fields!MyColumn.Color', but I don't know how to initialize it. Please help.

This is a code fragment I use to load some data to the report:

IDataReader dataReader = command.ExecuteReader();
  dataset.Tables["dtTable"].Load(dataReader);
  dataReader.Close();

  //provide local report information to viewer
  reportViewer.LocalReport.ReportEmbeddedResource =
       "Client.Reports.Reports.Sample.rdlc";

  //prepare report data sources
  ReportDataSource dsTable = new ReportDataSource();
  dsTable.Name = "dtTableData";
  dsTable.Value = dataset.Tables["dtTable"];
  reportViewer.LocalReport.DataSources.Add(dsTable);


I am not super familiar with the situation but it seems that if it takes a string you should be able to pass anything that the Color field in the report usually takes. Any string like "#ffffff" or "white" or an expression like '=IIF(Fields!MyColumn.Value = 1, "blue", "red")'. It if requires an integer, then you should set it according to http://msdn.microsoft.com/en-us/library/ms145991.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜