I have a telerik extension grid. I have to generate a html link based on various scenarios and show that link in inside the grid column. I have implemented it successfully using the Template. But I am having issue doing the same thing inside ClientTemplate for that column. I am trying to use String.IsNullOrEmpty() and another c# function inside ClientTemplate. I suspect the issue is due to trying to use these function inside ClientTemplate. Is it doable?
.ClientTemplate("<#if(IsUrgent){ #>" + "<# if( #> " + String.IsNullOrEmpty("<#= AssignedUser1 #>") + " ||" + String.IsNullOrEmpty("<#=AssignedUser2 #>") + "<#) { #>" +
"<a class='urgent-row' href=" + Url.Action("AssignUserDialog", "User", new { userNo = "<#= UserNo #>" }) + "><#= UserNo #></a>" +
"<# } else { #>" +
"<a class='' href=" + Url.Action("Index", "User", new { userNo = "<#= UserNo #>" }) + "><#= UserNo #></a>" +
"<# } #>"
"<# }
I searched over similar issues but only found examples where ClientTemplate used javascript functions, not C# functions.
Is is possible to do that?
You could just call a Javascript function that would call an action, using Jquery's $.ajax which would return the string you want inside the ClientTemplate.