Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
147991 | Sep 30,2019 12:04 PM UTC | Oct 12,2019 11:29 AM UTC | ASP.NET MVC - EJ 2 | 7 |
![]() |
Tags: RichTextEditor |
@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 />
} |
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.
This page will automatically be redirected to the sign-in page in 10 seconds.