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

Hyperlink to column content in grid

Thread ID:





120860 Oct 23,2015 08:42 AM UTC Oct 26,2015 10:21 AM UTC ASP.NET MVC 1
Tags: Grid
Gajanan Deshpande
Asked On October 23, 2015 08:42 AM UTC


i have grid as follow.







          .Columns(col =>



              col.Field("AccountGroupName").HeaderText("Account Name").Add();

              col.Field("VisitedDate").HeaderText("Visited Date").TextAlign(TextAlign.Center).Format("{0:MM/dd/yyyy}").Width(100).Add();



 I want hyperlink to each content in  "AccountGroupName" field, where the account group name is updated for every visit.
so what will be the script for template field?

if need controller

 public void InsertRecentlyViewedAccounts(string currentUserId, string AccountGroupName, DateTime VisitedDate) 
            //For recentlyviewedAccounts Grid on home page
            DataTable dtRecViewedAcc = new DataTable();
            DBDatabase dbManager = DBDatabase.Create("ARAContext");
            List<DBParam> values = new List<DBParam>();

            values.Add(DBParam.ParamWithValue (DbType.StringFixedLength,currentUserId));
            values.Add(DBParam.ParamWithValue(DbType.StringFixedLength, AccountGroupName));
            values.Add(DBParam.ParamWithValue(DbType.DateTime, VisitedDate));
            DBSelectQuery selectQuery = DBQuery.SelectAll()
                                               .From("RecentlyViewedAccounts").Where(DBField.Field("AccountGroupName"), Compare.Equals, DBParam.ParamWithValue(AccountGroupName)).And(DBField.Field("currentUserId"), Compare.Equals, DBParam.ParamWithValue(currentUserId));
            dbManager.ExecuteRead(selectQuery, reader =>
            if (dtRecViewedAcc.Rows.Count > 0)
                // update the existing record
                DBUpdateQuery strUpdateQuery = DBQuery.Update("RecentlyViewedAccounts")
                                        .Set("VisitedDate", DBParam.ParamWithValue(VisitedDate.Date))
                                        .Where(DBField.Field("AccountGroupName"), Compare.Equals, DBParam.ParamWithValue(AccountGroupName)).AndWhere(DBField.Field("currentUserId"), Compare.Equals, DBParam.ParamWithValue(currentUserId));
                DBInsertQuery strInsertQuery = DBQuery.InsertInto("RecentlyViewedAccounts")
                    .Fields("currentUserId", "AccountGroupName","VisitedDate")

Prasanna Kumar Viswanathan [Syncfusion]
Replied On October 26, 2015 10:21 AM UTC

Hi Gajanan,

Thanks for contacting Syncfusion support.

Your requirement has been achieved by using columnTemplate property of the ejGrid. A Column template is used to render a specific template to a particular column using Template and TemplateID property. In this template, we can render the images or checkboxes or any html elements to the column. So, using the column template we can render the hyperlink content for the particular column.

Please find the code example and sample:





        .ClientSideEvents(eve => eve.RecordClick("recordclick"))

        .Columns(col =>


            col.Field("EmployeeID").HeaderText("Employee ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();

            col.HeaderText("Employee Image").Template(true).TemplateID("#columnTemplate").TextAlign(TextAlign.Center).Field("LastName").Width(110).Add();

            col.Field("FirstName").HeaderText("First Name").Width(100).Add();






<script type="text/x-jsrender" id="columnTemplate">

    <a rel='nofollow' href="http://www.syncfusion.com/">{{:LastName}}</a>


Sample: http://www.syncfusion.com/downloads/support/forum/120860/ze/Sample145862_(2)704426861

Refer to the Help document for the Column Template API.

ColumnTemplate: http://help.syncfusion.com/aspnetmvc/grid/columns#template

We also created a KB documentation to place hyperlink in the grid columns. Please find the documentation from the following link


Query : “where the account group name is updated for every visit”

While clicking the hyperlink content, you want a post to the controller with the selected records. If not, could you please elaborate the requirement, it will be helpful to provide a better solution.

Prasanna Kumar N.S.V


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