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

Prevent TextBox from trimming TextBox value

5 Answers 95 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ivan
Top achievements
Rank 1
Ivan asked on 05 Mar 2013, 12:08 PM
Hi,

I am trying to use custom indentation for the value of a TextBox control but the value gets automatically trimmed. 

i.e. if i use the following expression no leading spaces are displayed.

= Space(CInt(CInt(Fields.Level) * 10)) + Fields.Text 

I also tried using a user function with the same result. 

Can i prevent this trimming behavior? 

thanks.

5 Answers, 1 is accepted

Sort by
0
Ivan
Top achievements
Rank 1
answered on 05 Mar 2013, 12:15 PM
Actually leading, trailing and repeating spaces inside the string are all removed. How can I use the original string? 
0
Ivan
Top achievements
Rank 1
answered on 05 Mar 2013, 03:50 PM
I managed to get around the trimming by binding the padding.left property,
but I would still like to know if it is possible to display the provided string literal without trimming.
0
Elian
Telerik team
answered on 07 Mar 2013, 09:49 AM
Hi Ivan,

The spaces in the TextBox item should not be trimmed. Are you by chance referring to the HtmlTextBox item? If so, then it is expected for the HtmlTextBox to trim the white-spaces using the same rules as the HTML markup. If you want to have spaces in the HtmlTextBox, you should encode them as  
The HtmlTextBox is created to provide formatting capabilities and if you don't need them it is recommended to use the regular TextBox
 

Regards,
Elian
the Telerik team

Telerik Reporting Q1 2013 available for download with impressive new visualizations. Download today from your account.

0
Ivan
Top achievements
Rank 1
answered on 07 Mar 2013, 11:53 AM
Hi Elian,

I am using the TextBox control (not the HtmlTextBox) and when the report is displayed in the asp.net WebForms viewer, the spaces are being trimmed. I tested the behavior several times. I will prepare a short sample later today.

Ivan
0
Elian
Telerik team
answered on 11 Mar 2013, 05:55 PM
Hello Ivan,

Thank you for the clarification, we will consider a way for keeping the spaces. 
Meanwhile you can use the HtmlTextBox item instead (replacing the spaces with  ). 

All the best,
Elian
the Telerik team

Telerik Reporting Q1 2013 available for download with impressive new visualizations. Download today from your account.

Tags
General Discussions
Asked by
Ivan
Top achievements
Rank 1
Answers by
Ivan
Top achievements
Rank 1
Elian
Telerik team
Share this question
or