Telerik Report Designer - Remove line if the parameter is NULL

故事扮演 提交于 2019-12-14 03:21:47

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!