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

Automatic Trimming in RadGrid

3 Answers 228 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Saravanan
Top achievements
Rank 1
Saravanan asked on 30 Dec 2010, 08:40 AM
hi,
   I am trying to display a Record in RadGrid, which contains some continuous spaces. But in RadGrid it is automatically trimed. For example the record has "s      a" but it displays "s a". Is there any property for this or we cannot restrict that.

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 03 Jan 2011, 01:47 PM
Hello Paramahamsa,

Add the following CSS in the Item style property of the GridBoundColumn to prevent the trimming of spaces in the column.

ASPX:
<telerik:GridBoundColumn UniqueName="LastName" DataField="LastName" HeaderText="LastName">
        <ItemStyle CssClass="preserveSpace" />
</telerik:GridBoundColumn>

<style type="text/css">
       .preserveSpace
       {
           white-space: pre;
       }
</style>

Thanks,
Princy.
0
Andy Steinfeld
Top achievements
Rank 1
answered on 04 Jan 2011, 05:41 PM
This looked very straightforward, however, when I applied it, it didnt retain the whitespace.

Is there somethign else I need to do.

/Andy

My code behind line:

boundColumn.ItemStyle.CssClass =

 

"preserveSpace";

 



My .css file

 

 

.preserveSpace

 

{

 

 

white-space: pre;

 

}

0
Princy
Top achievements
Rank 2
answered on 05 Jan 2011, 07:03 AM
Hello Andy,

Please make sure that you have refered that CSS file in your page.

ASPX:
<link href="Myt.css" rel="stylesheet" type="text/css" />

Thanks,
Princy.
Tags
Grid
Asked by
Saravanan
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Andy Steinfeld
Top achievements
Rank 1
Share this question
or