- Home
- Forum
- ASP.NET MVC
- How to send data from the server side
How to send data from the server side
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">
<p><b>Description:</b></p><p></p><ul style='list-style-type: square;'><li>The Rich Text Editor (RTE) control is an easy to render in client side.&nbsp;<br></li><li>Customer easy to edit the contents and get the HTML content for the displayed content.<br></li><li>&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.<br></li></ul><p></p>
</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="<p><b>Description:</b></p><p></p><ul style='list-style-type: square;'><li>The Rich Text Editor (RTE) control is an easy to render in client side.&nbsp;<br></li><li>Customer easy to edit the contents and get the HTML content for the displayed content.<br></li><li>&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.<br></li></ul><p></p>";
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
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">
<p><b>Description:</b></p><p></p><ul style='list-style-type: square;'><li>The Rich Text Editor (RTE) control is an easy to render in client side.&nbsp;<br></li><li>Customer easy to edit the contents and get the HTML content for the displayed content.<br></li><li>&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.<br></li></ul><p></p>
</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="<p><b>Description:</b></p><p></p><ul style='list-style-type: square;'><li>The Rich Text Editor (RTE) control is an easy to render in client side.&nbsp;<br></li><li>Customer easy to edit the contents and get the HTML content for the displayed content.<br></li><li>&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.<br></li></ul><p></p>";
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
SIGN IN To post a reply.
1 Reply
KR
Keerthana Rajendran
Syncfusion Team
August 10, 2017 09:36 AM UTC
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.
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
-
JA Jacob
- Aug 9, 2017 08:14 AM UTC
- Aug 10, 2017 09:36 AM UTC