'Kendo grid popup editor model binding problem
I am using kendo grid popup editor with a template.
.Editable(c => { c.TemplateName("_CustomTemplate").Mode(GridEditMode.PopUp); })
This is the _CustomTemplate i am using
@model Models.CustomViewModel
<div id="popupeditor">
@Html.HiddenFor(model => model.Id)
<button type="button" id="NewEmailButton">Add New Email</button>
</div>
And the template is using this model.
public class CustomViewModel
{
public string Name { get; set; }
public List<string> EmailList { get; set; } = new List<string>();
}
User can add new input for email by clicking the "Add New Email" button. I am adding the input to PopUp container with javascript.
function AddEmail()
{
let index = 0;
let input = '<input name="EmailList[index]" type="text"/>'
$(input).appendTo('#popupeditor');
}
The problem is when i add or remove email it doesn't save, it doesn't go to save method. If i edit the Name it goes to the Save method but EmailList does not bind to model, it stays empty.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
