Hi Team,
I have a grid with columns that has dropdownlists. I am using EditorTemplates for these dropdownlists. My concern is that I am unable to make these columns readonly on Edit. However, I am able to make the other non-dropdown columns to do the same behaviour and it works.
this is my column setup:
columns.Bound(a => a.Account).ClientTemplate("#=Account.AccountName#").Width(200);
columns.Bound(a => a.dtEffectiveDate).Width(200);
this is my editor template:
@model GlobalCommissionAndAccountAssignments.Models.AccountUpdate.AccountModel
@{
ViewBag.Title = "AccountsList";
}
@(Html.Kendo().DropDownListFor(m => m)
.DataValueField("AccountId")
.DataTextField("AccountName")
.BindTo((System.Collections.IEnumerable)ViewData["accounts"])
)
My code t o make these columns as read-only on edit:
.Events(e => e.Edit("onGridEdit"))
<script>
function onGridEdit(e) {
if (e.model.isNew() == false) {
$('input[name=dtEffectiveDate]').parent().html(e.model.dtEffectiveDate); ----> this works
$('input[name=Account]').parent().html(e.model.Account); ----> this does not work (the one using a model and client template and editor template)
}
}
</script>
Thank you in advance.
Sam