MVC Kendo Grid Hyperlink column
11,543
I don't think you can use Razor syntax in there, try..
.ClientTemplate("<a href=\"Controller/Action/#ModelPropertyHere#\">#AnotherModelPropertyHere#</a>")
Comments
-
7783 about 2 years
I want this first column 'Name' should be a 'hyperlink' template .But value should be binded from model for that hyper link each link have different name that comes from property of the model. How to do this? I tried in the following way its working good .!!
But I am getting all rows first column's hyperlink text as "Show Product Details". I want to get model values. I don't want it to be same for all columns
@(Html.Kendo().Grid<Cutomers.Model.CustomerDataModel>() .Name("grid") .Columns(columns => { columns.Bound(p => p.Name).ClientTemplate("<a href='" +Url.Action("ProductDetails", "Product") +"/#= FileName #'" +">Show Product Details</a>"); columns.Bound(c => c.CreatedDate).Width(70); columns.Bound(c => c.CreatedBy).Width(70); }) .HtmlAttributes(new { style = "height: 350px;" }) .Scrollable() .Groupable() .Sortable() .Pageable(pageable => pageable .Refresh(true) .PageSizes(true) .ButtonCount(1)) .DataSource(dataSource => dataSource .Ajax() .Read(read => read.Action("Customers_Read", "Home")) ) )
-
7783 over 9 yearscolumns.Bound(p => p.FileName).ClientTemplate( "<a href='" + Url.Action("ProductDetails", "Product") + "/#= FileName #'" + ">/#= FileName #</a>" );
-
Gareth Hopkins over 9 yearsGreat stuff, glad I could help, had the same problem myself when I started using Kendo Grids.