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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Dynamic hyperlink in grid control using column template or Custom command

Thread ID:

Created:

Updated:

Platform:

Replies:

145427 Jun 21,2019 07:44 AM UTC Jun 24,2019 09:23 AM UTC ASP.NET Core - EJ 2 1
loading
Tags: DataGrid
Muhammad Tassadaque Zia
Asked On June 21, 2019 07:44 AM UTC

HI
I am trying to add dynamic hyperlink column either by column template or custom command but it doesn't working. 

For Column Template

@foreach (var item in ViewBag.actions)
            {
            <e-grid-column field="OrderID" headerText="Manage" template="<a rel='nofollow' href='/EditBusinessPartner/masterdata/{{:OrderID}}'>test</a>" textAlign="Left" type="number" width="80"></e-grid-column>
            }

This code is not recognizing {{:OrderID}}

By Custom Command
I am following below documentation link
How to add url in below code
@{
    List<object> commands = new List<object>();
    commands.Add(new { type = "userstatus", buttonOption = new { content = "Details", cssClass = "e-flat e-details" } }); // custom
}

Thavasianand Sankaranarayanan [Syncfusion]
Replied On June 24, 2019 09:23 AM UTC

Hi Muhammad, 
 
Greetings from Syncfusion. 
 
Query: I am trying to add dynamic hyperlink column either by column template or custom command but it doesn't working 
 
We have validated your query and you want to create a dynamic hyperlink by using column template. Here, we have prepared a sample based on your requirement by using column template. Please find the below code example and sample for your reference. 
 
[code example] 
 
<div> 
    <ejs-grid id="Grid" dataSource="ViewBag.DataSource" allowResizing="true" allowPaging="true" allowSorting="true" toolbar="@(new List<string>() {"Add", "Edit", "Delete", "Cancel", "Update"})"> 
        <e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true" mode="Normal"></e-grid-editSettings> 
        <e-grid-columns> 
            <e-grid-column field="OrderID" headerText="Order ID" isPrimaryKey="true" width="120"></e-grid-column> 
            <e-grid-column field="EmployeeID" headerText="Employee ID" width="120"></e-grid-column> 
            <e-grid-column field="Freight" headerText="Freight" format="C2" width="120"></e-grid-column> 
            <e-grid-column field="ShipCity" headerText="Ship City" template="#template" width="120"></e-grid-column> 
            <e-grid-column field="ShipCountry" headerText="Ship Country" width="120"></e-grid-column> 
        </e-grid-columns> 
 
    </ejs-grid> 
</div> 
 
<script id="template" type="text/x-template"> 
    <div> 
        <a rel='nofollow' href="#">${ShipCity}</a> 
    </div> 
</script> 
 
 
 

Please get back to us if you need further assistance. 

Regards, 
Thavasianand S. 


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

Live Chat Icon For mobile
Live Chat Icon