This question is locked. New answers and comments are not allowed.
Hello,
i have the following EditorTemplate.
The bool value for IsCured will never post. How can i achieve this goal?
Mit Update/Insert Action:
i have the following EditorTemplate.
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<TumourResectionTypeViewModel>" %> <%= Html.DropDownList( null, new SelectList( ( IEnumerable )ViewData["tumourResectionTypes"], "TumourResectionTypeId", "TypeName" ), new { style = "width: 50%;" } )%> <%= Html.LabelFor( m => m.IsCured ) %> <%= Html.CheckBoxFor( m => m.IsCured ) %> <script type="text/javascript"> var $dropdown = $('#TumourResectionType'); $('<option/>', { text: '...', value: "" }).prependTo($dropdown); var $tr = $dropdown.closest('tr:has(form)'); var grid = $tr.closest('.t-grid').data('tGrid'); var dataItem = grid.dataItem($tr); $dropdown.val(dataItem.TumourResectionType ? dataItem.TumourResectionType.TumourResectionTypeId : ""); var c = $tr.find("input[type=checkbox]:first"); var l = $tr.find("label:first"); if (dataItem.TumourResectionType.IsCured) { c.attr("checked", "checked"); } else { c.removeAttr("checked"); } $dropdown.change(function () { if ($(this).val() == 1) { l.show(); c.show(); } else { l.hide(); c.hide(); } }).change(); </script>The bool value for IsCured will never post. How can i achieve this goal?
Mit Update/Insert Action:
public ActionResult _Update( GridCommand command, int tumourResectionType, bool isCured = false, int id = 0 )
IsCured is always false.
Regards,
Timo