Rendering anchor tags with custom commands in DataGrid ASP.NET Core

Hello, according to this documents https://ej2.syncfusion.com/aspnetcore/documentation/grid/edit/#command-column
we can generate some buttons in our grid, but I want to generate a tags,
how can i achieve this ?

1 Reply 1 reply marked as answer

MS Manivel Sellamuthu Syncfusion Team November 3, 2020 10:46 AM UTC

Hi Armin, 

Greetings from Syncfusion support. 

Query: I want to generate a tags, how can i achieve this ? 

You can achieve this requirement by using Grid’s column template to define a URL link based on the field value of the data source. This is demonstrated in the below code snippet, 

<div> 
    <ejs-grid id="Grid" dataSource="ViewBag.DataSource" allowPaging="true"> 
        <e-grid-columns> 
           . . . 
<e-grid-column field="ShipCountry" headerText="Ship Country" template="#template" width="150"></e-grid-column> 
        </e-grid-columns> 
    </ejs-grid> 
</div> 
 
    // Here ‘ShipCountry’ field value is accessed 
<script id="template" type="text/x-template"> 
    <a target="_blank" rel='nofollow' href="https://en.wikipedia.org/wiki/${ShipCountry}">${ShipCountry}</a> 
</script> 


Please let us know, if you need further assistance. 

Regards, 
Manivel 


Marked as answer
Loader.
Up arrow icon