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

RadEditor shows only 50 character from content.

6 Answers 252 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Harish
Top achievements
Rank 1
Harish asked on 02 Jul 2015, 08:27 AM

Hi All,

I am using RadEditor control n the grid.

I want to show the only first 50 character content or may be forst row from the content.

Please help me how to achieve this.

Thanks,

Harish Patil

6 Answers, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 06 Jul 2015, 10:02 AM
Hello Harish,

Can you provide some more details about the scenario implemented?

Is the editor editable when you need to show the content, or not? Is it used in EditTemplate or InsertTemaplate?

By providing a sample markup of the current implementation will be helpful to define what is the exact scenario.

Regards,
Ianko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Harish
Top achievements
Rank 1
answered on 07 Jul 2015, 10:37 AM

Hi Lanko,

Actually I have one RadEditor control inside RadGrid.

1. Insert content from RadEditor control in database as per formatting.

Eg. Content Saved in Database: <strong><em><span style="font-size: 20px; text-decoration: underline; color: #ff0000; background-color: #ffc000;">WOW <span style="color: #000000; background-color: #ffffff;">12356432569874563215346985763259874561235478965324</span></span></em></strong>

2. After grid binding data is showing as formatting with GridBoundColumn. (Bold, Italic, Underline, Font)

 <telerik:GridBoundColumn UniqueName="Content" HeaderText="Content" DataField="Content">
                        <HeaderStyle Width="60px"></HeaderStyle>
                    </telerik:GridBoundColumn>

3. Now when grid gets bind with formatted content I want to bind only first 50 character. And after when I will click on specific grid row then grid will be in Edit Mode. That time all content will show.

 If you need more information ?

Can you please tell me how to achieve above scenario ?

 

Thanks,

Harish Patil

0
Accepted
Ianko
Telerik team
answered on 08 Jul 2015, 08:31 AM
Hello Harish,

The best way to implement that is to have two columns in the database—one with the review of text and second with teh full text.

Programmatically, the GridColumn to be bound with the review field, and in Edittemplate, RadEditor to the full content. Subsequently, upon saving content, update programmatically both full text and review text in the database.

Regards,
Ianko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Harish
Top achievements
Rank 1
answered on 13 Jul 2015, 02:58 AM

Hi Lanko,

Thanks for the suggestion. It will work for me.

But I am using following code, How I can save the only 50 characters in second field(review) ?

With the following code I am getting HTML format code but how to get from HTML 50 characters ?

Coz those 50 characters also should be formatted.

Code:

obj.Content = string.IsNullOrEmpty((formItem.FindControl("txtContent") as RadEditor).Content) ? string.Empty : (formItem.FindControl("txtContent") as RadEditor).Content;

 

Thanks,

Harish Patil

0
Accepted
Ianko
Telerik team
answered on 13 Jul 2015, 05:26 AM
Hello Harish,

There is no built-in option to achieve that. This should be implemented via custom logic that traverses the HTML, gather the needed amount of text and generate a valid HTML output.

This is purely a programmatic task that should be designed and built from scratch. I cannot suggest you a ready-to-use solution for this situation.

Regards,
Ianko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Harish
Top achievements
Rank 1
answered on 15 Jul 2015, 09:44 AM

Hi Lanko,

 Thanks, I have resolved the issue as per your suggestion.

Solution: The best way to implement that is to have two columns in the database—one with the review of text and second with teh full text.

Thanks,
Harish Patil​

Tags
Editor
Asked by
Harish
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Harish
Top achievements
Rank 1
Share this question
or