In a C# based Win forms application I am working on a report using Microsoft Report Viewer. There is a requirement that I have to display multiple fields in one cell of the table, all in a new line.
- I have tried to use new line characters in expression but didnt work. There is no multi-line property of textbox.
- I have tried to use a list with multiple textboxes in the cell. But
it gives error that:
The tablix has a detail member with inner members. Detail members can
only contain static inner members
Some people say something like adding groups but I could not figure how to do this.
Could you please let me know how can show multiple fields in row like:
Product Name
Product Color
Poduct Size
Thanks to @Hemant’s suggestion I managed to solve it like this:
In Report -> Report Properties -> Code, I entered this code:
Function GetBreakupstring(value) as String
return value.Replace("--M--", Environment.NewLine)
End Function
In Textbox’s expression I entered:
=Code.GetBreakupstring(Fields!Name.Value & "--M--" & Fields!IDProducts.Value & "--M--" & Fields!Color.Value)
Then I tried to simple use Environment.NewLine in expression which I also worked. This is what expression is looking right now:
=Fields!Name.Value & Environment.NewLine & Fields!IDProducts.Value & Environment.NewLine & Fields!Color.Value
you can write a function in VB Code that breaks your input into multiple line and call that function in text box
as
Textbox expression= Code.GetBreakupstring(field.parameter)
and write this
public sub GetBreakupstring(value){
return break value;
}