Articles in this section
Category / Section

How to place Hyperlink in grid column

1 min read


How to place Hyperlink in grid column


We can place Hyperlink or any other controls inside grid cells using the Column template feature of the grid. The template to a particular column can be provided by using Template and TemplateID properties of the column.

Using template string

The template string will be provided during grid initialization as follows.


                dataSource: window.gridData,
                columns: [
                         { field: "OrderID", headerText: "Order ID" },
                         { field: "CustomerID", headerText: "Customer ID" },
                         { headerText: "Manage Records", 
                                template: "<a href=’#’>View</a>" 
                create: "onGridCreate"



        .Columns(col =>
                col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true). Add();
                col.Field("CustomerID").HeaderText("Customer ID").Add();
                 col.HeaderText("Manage Records")
                    .Template(" <a href='#''>View</a>").Add();




<ej:Grid id="Grid" runat="server" AllowPaging="true">         
             <ej:Column Field="OrderID"/>
             <ej:Column Field="CustomerID""/>                             
             <ej:Column HeaderText="Manage Records" Template="<a href='#'>View</a>" />             
         <ClientSideEvents Create="onGridCreate"/>


Perform action on clicking hyperlink

It is our sole responsibility to perform any action on clicking the link in the particular cell. For that we have to bind event to the hyperlink. But the hyperlink will be visible once the grid is render and so binding the event on DOM load is not sufficient. We can achieve this requirement using the Create event of the grid as follows.

<script type="text/javascript">
        function onGridCreate(args) {
            this.element.find(".e-gridcontent").on("click","a", function (e) {
                //Do something


The output will be also follows.


Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Please sign in to leave a comment