We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

text/x-jsrender not working

Please take a look
@(Html.EJS().Grid("Grid").DataSource(ds => ds.Url(@Url.Action("KycDatasource", "Admin")).Adaptor("UrlAdaptor")).AllowSorting().Columns(col =>
                        {                                                                                                                    col.Field("Status").HeaderText("Status").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Center).Template("#statusTemplate").Width("80").Add();
                            col.HeaderText("Action").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Center).Template("#template").Width("150").Add();
                        }).Render())
Then my jsrender is:
<script id="template" type="text/x-jsrender">
    {{if Status == "Pending"}}
    <a class="badge badge-danger" rel='nofollow' href="/Admin/AcceptKyc/${NumberId}">Accept</a>
    {{/if}}
</script>
Result:


What did I do wrong?



3 Replies

MS Madhu Sudhanan P Syncfusion Team December 7, 2018 12:03 PM UTC

Hi Nguyen, 

Thanks for contacting Syncfusion support. 

Essential JS 2 ASP.NET MVC controls uses ES6 like template syntax which is compiled and executed using Essential JS 2 Template engine.  



Now your will look like below to work properly. 


<script id="template" type="text/x-template"> 
    ${if(Status == "Pending")} 
    <a class="badge badge-danger" rel='nofollow' href="/Admin/AcceptKyc/${NumberId}">Accept</a> 
    ${/if} 
</script> 


Regards, 
Madhu Sudhanan P 



GI Gin December 7, 2018 12:11 PM UTC

It's worked.

Thank so much.

Happy coding with Syncfusion :)


MS Madhu Sudhanan P Syncfusion Team December 7, 2018 12:23 PM UTC

Hi Nguyen, 

Thanks for the update. Please get back to us if you require any assistance. 

Regards, 
Madhu Sudhanan P 


Loader.
Live Chat Icon For mobile
Up arrow icon