Can you tell me how to add a Hyperlink column to a MVC ASP.NET Grid

1 Answer 32 Views
Grid
n/a
Top achievements
Rank 1
n/a asked on 17 May 2021, 08:28 PM

Can you tell me how to add a Hyperlink column to a MVC ASP.NET Grid?

I've tried everything i could find and none work.. JIRA_Ticket is the display value, and Service Desk holds the Hyperlink i want to open a new window with. It's possible i'm just not googling it right.. I'm fairly new to this so sorry if this is a dumb question.

    .Columns(columns =>
    {
        columns.Bound(m => m.JIRA_Ticket).Width(60).HtmlAttributes(new { @class = "txtovflw" });
        //.ClientTemplate("<a href='" + Url.Content("\\#= ServiceDesk \\#") + "' target='_blank'>\\#= ServiceDesk \\#Link</a>");
        //.ClientTemplate("<a href='\\#' onclick='proposalWindow(#= ServiceDesk #)'>" + "#= JIRA_Ticket #" + "</a>").Title("Title");

I just want to be able to click on the JIRA ticket column in the grid and open the servicedesk link in the model.

If this is not possible, happy to go with an action button..

 

Any help appreciated

 

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 20 May 2021, 11:38 AM

Hello,

To add a hyperlink to the column, the Template should be declared as shown below:

.ClientTemplate("<a href='" + Url.Content("#= ServiceDesk #") + "' target='_blank'>#= ServiceDesk #Link</a>"); 

Note that the # symbol is not escaped with \\

Regards,
Ivan Danchev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

n/a
Top achievements
Rank 1
commented on 20 May 2021, 11:56 AM

Hi, thanks for this unfortunately it errors for me with this message.

Just to confirm,

I have both JIRA_Ticket and ServiceDesk in the model, HIRA_Ticket is just the ID, ServiceDesk is the full URL.. I would like to bind the JIRA_Ticket column to the grid but open ServiceDesk as the URL..

Any ideas what's going wrong with the code you provided?

Thanks

VM923:3 Uncaught ReferenceError: ServiceDesk is not defined
at eval (eval at compile (kendo.all.js:234), <anonymous>:3:301)
at init._rowsHtml (kendo.all.js:69694)
at init._renderContent (kendo.all.js:70520)
at init.refresh (kendo.all.js:70340)
at init.i (jquery.min.js:2)
at init.trigger (kendo.all.js:164)
at init._process (kendo.all.js:7994)
at init.success (kendo.all.js:7690)
at success (kendo.all.js:7581)
at Object.n.success (kendo.all.js:6452)
n/a
Top achievements
Rank 1
commented on 20 May 2021, 12:09 PM

Please ignore that last reply.. it works pefectly.. My mistake.. Thanks for this, it was really appreciated
Tags
Grid
Asked by
n/a
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or