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

Major problems formating a grid field

2 Answers 61 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Boris
Top achievements
Rank 1
Boris asked on 31 Oct 2012, 08:14 PM
I'm not sure where to begin with this one.

I have a RadGrid with a bound text field that is 2000 char long in the DB.  The user can go into the popup and edit it with the RadEditor (and basically do anything he or she wants with color and size.)

What I'd like to be able to do is perhaps display only the first 20-30 characters of the field in the grid in a fixed length column with no wrap and fixed font size (and no colors.)

Is it possible to do this in the properties or do I need to use CSS?

What I don't want is what I've put in the picture.

How do I do this?

2 Answers, 1 is accepted

Sort by
0
Galin
Telerik team
answered on 05 Nov 2012, 07:30 PM
Hi Boris,

Thank you for contacting us.

You can achieve this by using template column, e.g.

Markup
<telerik:GridTemplateColumn>
    <ItemTemplate>
        <span class="myText" title='<%#DataBinder.Eval(Container, "DataItem.Name")%>'><%#DataBinder.Eval(Container, "DataItem.Name").ToString().Substring(0, 20) + "..."%></span>
    </ItemTemplate>
</telerik:GridTemplateColumn>


CSS
.myText
{
    color: Red;
    font-size: 12px;
    white-space:nowrap;
}

Please do not hesitate to contact us if other questions or problems arise.

All the best,
Galin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Boris
Top achievements
Rank 1
answered on 05 Nov 2012, 07:34 PM
Actually I just found an entirely different solution at: http://www.telerik.com/community/forums/aspnet-ajax/grid/displaying-rich-text-as-plain-text-in-radgrid-column.aspx

Then I call it in ItemDataBound.

But thanks!

 

Tags
Grid
Asked by
Boris
Top achievements
Rank 1
Answers by
Galin
Telerik team
Boris
Top achievements
Rank 1
Share this question
or