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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Column Template not working in EJ2 Grid

Thread ID:

Created:

Updated:

Platform:

Replies:

142298 Jan 25,2019 06:43 PM UTC Feb 7,2019 04:46 AM UTC ASP.NET MVC - EJ 2 3
loading
Tags: Grid
Fabrizio Alessandro
Asked On January 25, 2019 06:43 PM UTC

Hello,
I am moving to Essential JS 2, but I have an issue with Column Template in Grid control,
in the cell of a templated column I can only see the template id, as in the image:
(Last column has template)


Here is the code for the Grid:

@(Html.EJS().Grid<AffidoItem>("Grid").DataSource((IEnumerable<AffidoItem>)ViewBag.Affidi).AllowSorting().AllowMultiSorting().AllowSelection(false).GridLines(GridLine.Both)
.Columns(col =>
                {
                    string width = (100).ToString("P");
                    col.Field("NUMERO_AFFIDAMENTO").HeaderText("N. Affidamento").TextAlign(TextAlign.Left).Width(width).Add();
                    col.Field("DATA_AFFIDO_ESA").HeaderText("Affido").TextAlign(TextAlign.Left).Format("yMd").Width(width).Add();
                    col.Field("DATA_SCAD_ESA").HeaderText("Scadenza").TextAlign(TextAlign.Left).Format("yMd").Width(width).Add();
                    col.Field("DATA_PROROGA_ESA").HeaderText("Proroga").TextAlign(TextAlign.Left).Format("yMd").Width(width).Add();
                    col.Field("NUMERO_PRATICHE").HeaderText("N. Pratiche").TextAlign(TextAlign.Right).Width(width).Add();
                    col.Field("CAPITALE_SCADUTO").HeaderText("Capitale").TextAlign(TextAlign.Right).Format("C2").Width(width).Add();
                    col.Field("TOTALE_SCADUTO").HeaderText("Totale").TextAlign(TextAlign.Right).Format("C2").Width(width).Add();
                    col.HeaderText("Azioni").Template("#template").TextAlign(TextAlign.Center).Width(100).Add();
                }).Render()
)

The template code:
<script id="template" type="text/x-template">
     <p>${:NUMERO_AFFIDAMENTO}</p>
</script>

Thank You,
Fabrizio

Madhu Sudhanan P [Syncfusion]
Replied On January 28, 2019 04:29 AM UTC

Hi Fabrizio, 

Thanks for contacting Syncfusion support. 

Essential JS 2 for ASP.NET MVC uses ES6 template format placeholder with our own template engine. Your code should be changed as below to work properly. 

<script id="template" type="text/x-template"> 
    <p>${NUMERO_AFFIDAMENTO}</p> 
</script> 


Regards, 
Madhu Sudhanan P 


Fabrizio Alessandro
Replied On February 6, 2019 11:28 PM UTC

Thank you now it is correct!

Madhu Sudhanan P [Syncfusion]
Replied On February 7, 2019 04:46 AM UTC

Hi Fabrizio, 
Thanks for the update. Please get back to us if you need further assistance. 
Regards, 
Madhu Sudhanan P 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;