问题
I am working for the first time ( hopefully last) with Telerik Report Designer and I am struggling with something.
I have linked a data source to my report and what I am trying to achieve is to remove empty line when the parameter is NULL.
This is how it looks right now: enter image description here
Since ServiceLocationAddressLine2 and ServiceLocationAddressLine3 are empty, it leaves 2 empty rows as shown above.
How do I fix that?
Thanks
Telerik Interface
回答1:
you can use ItemDataBinding property of a textbox, detail section etc. to check for the specific value (in your case ServiceLocationAddressLine2 and ServiceLocationAddressLine3) and set the visibility to true if address present or false if address not present.
the code is just a sample code for your reference
private void textBox1_ItemDataBinding(object sender, EventArgs e)
{
Telerik.Reporting.Processing.TextBox txt = (Telerik.Reporting.Processing.TextBox)sender;
if (string.IsNullOrEmpty(txt.Value.ToString()))
{
txt.Visible = false;
}
else
{
txt.Visible = true;
}
}
回答2:
I finally got it fixed - my issue was that the textboxs needed to be inside a Panel rather than floating around.
By doing that if the parameter passed is NULL and the textbox option 'CanShrink'is set to True it won't show up :)
来源:https://stackoverflow.com/questions/45844521/telerik-report-designer-remove-line-if-the-parameter-is-null