public class MyClass
{
public string[] Multiselect { get; set; }
} |
@Html.EJS().MultiSelect("userArray").DataSource((IEnumerable<object>)ViewBag.perms).Placeholder("" + "Insumos").Mode(VisualMode.CheckBox).ShowDropDownIcon(true).ShowSelectAll(true).Fields(new MultiSelectFieldSettings { Text = "Name", Value = "Id" }).Render() |
public ActionResult Update([FromBody]MyClass model)
{
string[] items = model.usersArray;
return Json(model);
}
public class MyClass
{
public string[] usersArray { get; set; }
} |
@section controlsSection{ |
[DialogTemplate]
@Html.Label("", "Usuarios") @Html.EJS().MultiSelect("usersArray").DataSource((IEnumerable<object>)ViewBag.perms).Mode(VisualMode.CheckBox).ShowDropDownIcon(true).ShowSelectAll(true).Fields(new MultiSelectFieldSettings { Text = "Name", Value = "Id" }).Render() </object> |
[Controller]
public ActionResult Insert(Users value, [FromBody]PermissionsModel model) { string[] element = model.usersArray; value.deleted = false; value.password = GeneratePassword(value.password); db.Users.Add(value); db.SaveChanges(); return Json(value); } |
[PermissionsModel ]
public class PermissionsModel { public string Id { get; set; } public string Name { get; set; } public string[] usersArray { get; set; } public List { List permissions.Add(new PermissionsModel() { Id = "0", Name = "Ver" }); permissions.Add(new PermissionsModel() { Id = "1", Name = "Crear" }); permissions.Add(new PermissionsModel() { Id = "2", Name = "Modificar" }); permissions.Add(new PermissionsModel() { Id = "3", Name = "Eliminar" }); return permissions; } } |
ActionBegin:
function actionBegin(args) {
if (args.requestType == "save") {
var editDialog = document.getElementsByClassName("e-edit-dialog ")[0];
var value = editDialog.querySelector("#ShipCity").ej2_instances[0].value.join(','); // convert the array values to string
args.data.ShipCity = value; // Changed the default edited value with converted string value
}
} |