- Home
- Forum
- ASP.NET MVC
- Editor Templates with Syncfusion Controls
Editor Templates with Syncfusion Controls
Hello,
I want to override default MVC editor templates (~/Shared/EditorTemplates/). when I add a new view named Date include Syncfusion DatePickerFor, it doesn't work, if I only use DatePicker in this view it works but can't handle when editing.
What can I do?
SIGN IN To post a reply.
4 Replies
SA
Shameer Ali Baig Sulaiman Ali Baig
Syncfusion Team
June 6, 2017 12:39 PM UTC
Hi Emrah,
Thanks for contacting Syncfusion support.
We have analyzed your query. We can override the default MVC editor templates and can render the EJ DatePicker control in EditorTemplates folder by EditorFor control in any view. In the model we can use DateAnnotations link UIHint and DataType attributes to state the template formats to use.
myModel.cs
|
using System.ComponentModel.DataAnnotations;
public class MyViewModel
{
[UIHint("WorkAround")]
public DateTime Patched { get; set; }
} |
The editorFor control uses the model and goes to partialView WorkAround.cshtml and renders DatePicker.
Index.cshtml
|
@model IDErrorSample.Models.MyViewModel
@{
ViewBag.Title = "Show Bug";
}
@Html.EditorFor(model => model.Patched)
|
WorkAround.cshtml
|
@model DateTime
@{
var id = Html.ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldId("");
}
<dl>
<dd>@Html.EJ().DatePickerFor(m=>m, new Dictionary<string, object> { { "id", id } }).DateFormat("dd/MMM/yyyy")</dd>
</dl>
|
For your convenience, we have prepared a work around sample to meet your requirement. Please, find the sample in the below link.
Also, use the below links to know more about the sample.
Please, let us know for any further assistance.
Regards,
Shameer Ali Baig S.
SA
Shameer Ali Baig Sulaiman Ali Baig
Syncfusion Team
June 6, 2017 12:51 PM UTC
Hi Emrah,
Sorry, we missed to update the sample in previous update.
Please, find the sample for editor templates using EJ DatePicker in the below link.
Sample: Editor Templates
Regards,
Shameer Ali Baig S.
EM
Emrah
June 9, 2017 06:11 AM UTC
Thank you so much,
Regards.
SA
Shameer Ali Baig Sulaiman Ali Baig
Syncfusion Team
June 12, 2017 12:29 PM UTC
Hi Emrah,
Most Welcome.
Please let us know, if you need any further assistance.
Regards,
Shameer Ali Baig S.
SIGN IN To post a reply.
- 4 Replies
- 2 Participants
-
EM Emrah
- Jun 5, 2017 12:08 PM UTC
- Jun 12, 2017 12:29 PM UTC