columns.Bound(e => e.CreateDate).ClientTemplate("# if (CreateDate != null){#"
+ @Html.Action("ChangeDate", "Home", new {date = "#= CreateDate #"}) +
"#} else if ((CreateDate) == null)" +
"{#-#}#");
The ChangeDate action add year to date, but I got the following error:
The parameters dictionary contains a null entry for parameter 'date' of non-nullable type 'System.DateTime' for method 'System.String ChangeDate(System.DateTime)'
as error says the date value is null .
If
CreateDatecan benull, you need to check fordata.CreateDateinstead.