I have a grid which displays a field called "Import Type". There are various options under the Import Type based on a pre-defined enum model. One of the ImportType options is "Custom". If the user selects a Custom option, then another column next to it, "Mapping" needs to be enabled and mandatory. If the user selects any other ImportType, then "Mapping" needs to be blank and disabled. That is, if ImportType = "Custom" then Mapping is a mandatory cell for that particular row. If ImportType != "Custom" then Mapping should be disabled and blank. This ideally needs to be realtime during edit mode. So if the user clicks Edit and makes changes, this needs to be reflected instantly.
I'm struggling to get this working at all, mainly as I'm not sure what I'm doing it. Here is my code for the column so far.
columns.Bound(c => c.ImportType).Title(
"Import Type"
);
columns.Bound(c => c.Mapping).Title(
"Mapping"
)
.ClientTemplate(
"# if(ImportType== Models.CommonEnums.ImportType.Custom) #"
+
"# { return MappingId.HasValue === true} #"
+
"# else {MappingId = ''} #"
);
Should I be using a Client Template? I have tried a few other things, using just .Template, however this didn't do much for me either.
Could you point me in the right direction?