This is a migrated thread and some comments may be shown as answers.

CRLF in Multiline Texbox on Report

3 Answers 872 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
George
Top achievements
Rank 1
George asked on 02 Nov 2007, 06:02 AM
Is there a way to force a CRLF in a multiline text box on a report?  I have a textbox with multiple fields, and want to force a CRLF between two of the fields...

The problem is, I've tried different things, including good old vbCRLF, and ancient CHR(13) + CHR(10), however, the report engine doesn't like either one.

Here is an example of where this could be useful:

I have the following fields:

Name
Address Line 1
Address Line 2
City, State Zip
Phone #

If each of the lines were in there own text box, and Address Line 2 was blank, I would have a blank line in the address.  Now, I can do a workaround with a series of IIF's in each of the textboxes from Address Line 2 down, but I'd rather do one large multiline textbox with all the fields in it, forcing CRLF's in the appropriate places, and only one IIF for the Address Line 2.

Part of my problem is I'm spoiled by a "Remove Line if Blank" feature.  And guys, yes, I know the reporting module is in it's infancy, so I realize there is room for improvement.  Consider this a feature request.

Thanks as always!!!

Kuba

3 Answers, 1 is accepted

Sort by
0
Hrisi
Telerik team
answered on 02 Nov 2007, 02:49 PM
Hi Kuba Cole,

There are many ways to accomplish your goal.

Your attempt to concatenate the strings from the fields rely on our implementation of the expression language. This expression language is not VB nor C#.  You can use our Expression editor to set the value of the TextBox. You can write the expression as:

= Fields.Name + "
" + Fields.AddressLine1 + IIF(Fields.AddressLine2, "
" + Fields.AddressLine2, "") + "
" + Fields.CityStateZip + "
" + Fields.Phone

Note how newline is inserted in the expression. In the Expression editor you should use Ctrl+Enter to insert a new line.

Another way is to use UserFunction for example MyFunction defined as shared member of the your Report class that
accepts fields and returns concatenated string. This approach allows you to use your favorite language.

Of course you can concatenate the fields in the SQL query and bind the TextBox to the result and avoid writing the complicated expression.

 
Sincerely yours,
Hrisi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
John
Top achievements
Rank 1
answered on 03 Jul 2008, 02:45 PM
I am trying to do the exact same thing. I'm almost there. I would like:

Fields.BillToAddress1
Fields.BillToAddress2

The addresses on separate lines, if billtoaddress2 exists. If not, I don't want a separate blank row. Here's my code, but the expression gives me an error when there is data in BillToAddress2.

=Fields.billToAddress1 + IIF(Fields.billToAddress2, "
" + Fields.billToAddress2, "")

Thx.
0
John
Top achievements
Rank 1
answered on 29 Aug 2012, 04:05 PM
I tried all of the things you suggested in your post and none of them work to force a CRLF between different data pieces within a text box in a Telerik report.  Below is the Value set for the text box with Ctl + Enter inserted.  Any help would be greatly appreciated.  I wouldn't think this is a difficult thing to do but it is turning out to be.

= Fields.Last_Name + "
" + Fields.PhoneNumber + "
" + Fields.Email_Address
Tags
General Discussions
Asked by
George
Top achievements
Rank 1
Answers by
Hrisi
Telerik team
John
Top achievements
Rank 1
John
Top achievements
Rank 1
Share this question
or