We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to send data from the server side

Thread ID:

Created:

Updated:

Platform:

Replies:

132030 Aug 9,2017 04:14 AM Aug 10,2017 05:36 AM ASP.NET MVC 1
loading
Tags: RichTextEditor
Jacob
Asked On August 9, 2017 04:14 AM

Hello,

I tried the RichTextEditor control these days,

Now I have an important issue needs to be solved.

The View page code is:

//=======================================================
@Html.EJ().RTE("rteSample").ContentTemplate(@<div id="textcontent1">

&lt;p&gt;&lt;b&gt;Description:&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ul style='list-style-type: square;'&gt;&lt;li&gt;The Rich Text Editor (RTE) control is an easy to render in client side.&amp;nbsp;&lt;br&gt;&lt;/li&gt;&lt;li&gt;Customer easy to edit the contents and get the HTML content for the displayed content.&lt;br&gt;&lt;/li&gt;&lt;li&gt;&amp;nbsp;A rich text editor control provides users with a toolbar that helps them to apply rich text formats to the text entered in the text area.&lt;br&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;

</div>).Width("820px").ToolsList(toolsList).Tools(tool => tool.Styles(style).Lists(lists).DoAction(doAction).Links(links).Images(images))
//=======================================================

It will worked well, please refer to the 001.png.

But when I used @Viewbag.content and send data, it is defined as string.

Will not compiled as HTML,please refer to the 002.png.

The Demo code is:
//=======================================================
//Controller
public ActionResult Demo()
{
    Viewbag.content="&lt;p&gt;&lt;b&gt;Description:&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ul style='list-style-type: square;'&gt;&lt;li&gt;The Rich Text Editor (RTE) control is an easy to render in client side.&amp;nbsp;&lt;br&gt;&lt;/li&gt;&lt;li&gt;Customer easy to edit the contents and get the HTML content for the displayed content.&lt;br&gt;&lt;/li&gt;&lt;li&gt;&amp;nbsp;A rich text editor control provides users with a toolbar that helps them to apply rich text formats to the text entered in the text area.&lt;br&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;";
    return View();
}

//View

@Html.EJ().RTE("rteSample").ContentTemplate(@<div id="textcontent1">

@Viewbag.content

</div>).Width("820px").ToolsList(toolsList).Tools(tool => tool.Styles(style).Lists(lists).DoAction(doAction).Links(links).Images(images))

//=======================================================

How did you do to send an HTML format from Controller to View?

Looking forward to your response.

Thanks a lot.

Best regards.



Attachment: pics_17ea2103.zip

Keerthana Rajendran [Syncfusion]
Replied On August 10, 2017 05:36 AM

Hi Jacob,     
   
Thank you for contacting Syncfusion Support.   
   
We suggest you to use @Html.Raw to display the Html in the correct format. Please refer to the below given code   
   
@{Html.EJ().RTE("rteSample").Width("100%").Locale("en-US").ContentTemplate(@<div id="textcontent1">   
    @Html.Raw(@ViewBag.Content)</div>).ShowFooter(true).Tools(tool => tool.Clear(clear).FormatStyle(formatStyle).Tables(tables).Links(links).Images(images).Effects(effects).Casing(casing).Font(font).Styles(style).Media(media).Alignment(alignment).Lists(lists).Clipboard(clipboard).DoAction(doAction).Indenting(indenting).View(view).Edit(Edit).Print(Print).CustomOrderedList(customOrder => customOrder.Css("e-rte-toolbar-icon e-rte-listitems customOrder").ListStyle("lower-greek").Name("orderInsert").Tooltip("Custom OrderList").Text("Lower-Greek").Add()).CustomUnorderedList(customUnOrder => customUnOrder.Css("e-rte-toolbar-icon e-rte-unlistitems customUnOrder").ListImage("url('../../Content/images/RichTextEditor/Smiley-GIF.gif')").Name("unOrderInsert").Text("Smiley").Tooltip("Custom UnOrderList").Add())).Render();}   
   
   
We have prepared a sample for reference. Please download the sample from the below link   
   
   
Regards,   
Keerthana.  
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;