- Home
- Forum
- ASP.NET MVC - EJ 2
- Column Template not working in EJ2 Grid
Column Template not working in EJ2 Grid
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()
{
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>
<p>${:NUMERO_AFFIDAMENTO}</p>
</script>
Thank You,
Fabrizio
SIGN IN To post a reply.
3 Replies
MS
Madhu Sudhanan P
Syncfusion Team
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
FA
Fabrizio Alessandro
February 6, 2019 11:28 PM UTC
Thank you now it is correct!
MS
Madhu Sudhanan P
Syncfusion Team
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
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
FA Fabrizio Alessandro
- Jan 25, 2019 06:43 PM UTC
- Feb 7, 2019 04:46 AM UTC