एमवीसी सीखना और मैं 3 फ़ील्ड के साथ एक पेज को लागू करने की कोशिश कर रहा हूं नाम-उपनाम-विवरण तो मेरे सीखने के उदाहरण में मैं कर्मचारियों को लोड कर रहा हूं और मुझे उन्हें बनाने और संपादित करने में सक्षम होना चाहिए।सीकेएडिटर एमवीसी 3 कार्यान्वयन सहायता
विवरण सीकेईडिटर का उपयोग करना चाहिए।
- मैं लोड कर सकते हैं कर्मचारियों
- मैं उन्हें
हालांकि मैं इस तरह के जो भी वर्णन फ़ील्ड में प्रकार उपयोगकर्ता के रूप में, विवरण को बचाने के लिए सक्षम होने के लिए नहीं कर पा रहे बचा सकता है। मैंने नेट पर कुछ उदाहरण देखे हैं लेकिन डाउनलोड करने के लिए कोई समाधान नहीं है, क्योंकि मैं एक साथ नहीं लग सकता। मैं एक शांत एचटीएमएल सहायक के साथ इस आदमी को मिल गया है, लेकिन एक साथ http://www.andrewbarber.com/post/CKEditor-Html-Helpers-ASPNET-MVC-Razor-Views.aspx
एक उदाहरण डाल करने के लिए सक्षम होने के लिए नहीं कर पा रहे समस्याएं हैं:
- कैसे आप मूल्य है कि CKeditor अंदर लिखा गया मिलता है ।
- मेरे विचार में मॉडल विवरण हर समय शून्य है
- ckEditor पृष्ठ के निर्माण को धीमा कर देता है। मैं इसे तेज़ी से कैसे बना सकता हूं? मुझे सभी विकल्पों की आवश्यकता नहीं है।
- वहाँ एमवीसी 3 का उपयोग कर एक उदाहरण है जिसे मैं टेम्पलेट के रूप में उपयोग कर सकता हूं।
मैं इस प्रकार सभी पाइपलाइन किया है:
Create.chtml
@model MvcApplicationCKEditorIntegration.Models.EmployeeViewModel
@{
ViewBag.Title = "Create";
}
<h2>
Create</h2>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Html.BeginForm())
{
@Html.ValidationSummary(true)
<fieldset>
<legend>EmployeeViewModel</legend>
<div class="editor-label">
@Html.LabelFor(model => model.FirstName)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.FirstName)
@Html.ValidationMessageFor(model => model.FirstName)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.LastName)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.LastName)
@Html.ValidationMessageFor(model => model.LastName)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Email)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Email)
@Html.ValidationMessageFor(model => model.Email)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.PhotoPath)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.PhotoPath)
@Html.ValidationMessageFor(model => model.PhotoPath)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Description)
</div>
<div class="editor-field">
<textarea class="ckeditor" id="ckeditor" rows="10"></textarea>
</div>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>
<script type="text/javascript" src="../../ckeditor/ckeditor.js"></script>
EmployeeController
public class EmployeeController : Controller
{
public ActionResult Index()
{
var employeeRepository=new EmployeeRepository();
var employees = employeeRepository.GetAll();
var employeeList = employees.Select(employee => new EmployeeViewModel
{
EmployeeId = employee.EmployeeId,
FirstName = employee.FirstName,
LastName = employee.LastName,
PhotoPath = employee.PhotoPath,
Email = employee.Email,
Description = employee.Description
}).ToList();
return View(employeeList);
}
public ActionResult Create()
{
return View(new EmployeeViewModel());
}
[HttpPost]
public ActionResult Create(EmployeeViewModel vm)
{
if(ModelState.IsValid)
{
var employeeRepository=new EmployeeRepository();
var emp=new Employee
{
FirstName = vm.FirstName,
LastName = vm.LastName,
Description = vm.Description,
Email = vm.Email,
PhotoPath = vm.PhotoPath
};
employeeRepository.Insert(emp);
return RedirectToAction("Index");
}
return View(vm);
}
}
}
किसी भी सुझाव के लिए धन्यवाद !!!
संपादित उदाहरण का उपयोग CKEditor सहायक
@using MvcApplicationCKEditorIntegration.Helpers
@model MvcApplicationCKEditorIntegration.Models.EmployeeViewModel
@{
ViewBag.Title = "Create";
}
<h2>
Create</h2>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@Html.CKEditorHeaderScripts()
@using (Html.BeginForm())
{
@Html.ValidationSummary(true)
<fieldset>
<legend>EmployeeViewModel</legend>
<div class="editor-label">
@Html.LabelFor(model => model.FirstName)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.FirstName)
@Html.ValidationMessageFor(model => model.FirstName)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.LastName)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.LastName)
@Html.ValidationMessageFor(model => model.LastName)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Email)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Email)
@Html.ValidationMessageFor(model => model.Email)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.PhotoPath)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.PhotoPath)
@Html.ValidationMessageFor(model => model.PhotoPath)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Description)
</div>
@Html.CKEditorFor(model=>model.Description)
<p>
<input type="submit" value="Create" onclick="@Html.CKEditorSubmitButtonUpdateFunction()" />
</p>
</fieldset>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>
<script type="text/javascript" src="../../ckeditor/ckeditor.js"></script>
आप उस ब्लॉग पोस्ट में पोस्ट किए गए समाधान का उपयोग नहीं कर रहे हैं; आप कहीं भी मददगार नहीं बुला रहे हैं। –