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.
Unfortunately, activation email could not send to your email. Please try again.

How to insert a dynamic template in the column?

Thread ID:

Created:

Updated:

Platform:

Replies:

131251 Jun 30,2017 09:13 AM Jul 3,2017 11:41 PM ASP.NET Core 3
loading
Tags: Grid
Emeline DESHAYES
Asked On June 30, 2017 09:13 AM

Hi,

How to insert a dynamic template in the column?
 

<ej-grid id="Grid" 
             datasource="ViewBag.DataSource"
             >
        <e-columns>
            <e-column field="State" header-text="State" width="70" Template="MyTemplate">
            <e-template><p>State</p></e-template>
             </e-column>
            <e-column field="NameInstance" header-text="Instance" width="80"></e-column>
            <e-column field="NameFile" header-text="Name of file" width="80"></e-column>
        </e-columns>
    </ej-grid>

Thanks

Mani Sankar Durai [Syncfusion]
Replied On July 3, 2017 08:35 AM

Hi Emeline 

Thanks for contacting Syncfusion support. 

We have analyzed your query and found that you would like to have template column in grid. Refer the code example of how to show the template column value in grid. 
 
<ej-grid id="FlatGrid" datasource="ViewBag.data" allow-paging="true" > 
   <e-columns> 
         <e-column field="EmployeeID" header-text="Employee ID" template="#MyTemplate" text-align="Right"  width="75"></e-column> 
      </e-columns> 
    
</ej-grid> 
<script type="text/x-jsrender" id="MyTemplate"> 
    <e-template><p>State</p></e-template> 
</script> 
 

Note: HTML templates can be specified in the Template property of the particular column as a string (html element) or ID of the template’s HTML element. You can use JsRender syntax in the template 
We have also prepared a sample that can be downloaded from the below link. 
To apply directly to the Template property in grid refer the below code example 
   <e-column field="EmployeeID" header-text="Employee ID" template="<e-template><p>State</p></e-template>" text-align="Right"  width="75"></e-column> 
       

Refer the documentation link 

Please let us know if you need further assistance 

Regards, 
Manisankar Durai. 


Emeline DESHAYES
Replied On July 3, 2017 08:46 AM

Thanks. It works.


Mani Sankar Durai [Syncfusion]
Replied On July 3, 2017 11:41 PM

Hi Emeline 

We are happy to hear that your problem has been solved. 

Please let us know if you need further assistance 

Regards, 
Manisankar Durai. 


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.

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.

;