@Html.EJS().RichTextEditor("email").Value((string)ViewBag.emailContent).Render()
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace WebApplication1.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
// Assume this firstName, lastName from database
var firstName = "John";
var lastName = "Michael";
// Bind fields content to RTE value property ViewBag emailContent varaible
ViewBag.emailContent = "
Hi " + @firstName + " " + @lastName + ", Sample mail body Regards, Admin "; return View();
}
}
}
|
<button id="fetchdata">Fetch data</button>
<script>
$("#fetchdata").click(function () {
new ej.data.DataManager({
url: "https://services.odata.org/V4/Northwind/Northwind.svc/Orders/",
adaptor: new ej.data.ODataV4Adaptor,
crossDomain: true
}).executeQuery(new ej.data.Query().where('OrderID', 'equal', 10258)).then((e) => {
alert("Hi " + e.result[0].CustomerID + ", \n\n Sample mail body \n\n Regards, \n John");
// Here you can use the returned data as per your requirement
});
});
</script> |
@{
ViewBag.Title = "Home Page";
ViewBag.items = new string[] {
"John", "Michael", "Davis", "Robert", "Alex",
"Sophia", "Isabella", "Emma", "Olivia", "Ava",
"Emily", "Abigail", "Madison", "Mia", "Chloe",
"Elizabeth", "Ella", "Addison", "Natalie", "Lily",
};
}
@foreach (var item in ViewBag.items)
{
<div>
@Html.EJS().RichTextEditor(item).Value("Hi " + item).Render()
</div>
<br /><br />
} |