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 ' Fields!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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.