Hi!
While implementing a grid column template for Action Link in syncfusion MVC, I have come across a problem where I am having trouble retrieving the primary key in Grid Column Template. My razor view code is given below.
@model List<Evolet.Domain.ViewModels.viewEmployee>
<h2> Employees Grid</h2>
@(Html.EJ().Grid<Evolet.Domain.ViewModels.viewEmployee>("EmployeeGrid")
.Datasource(Model)
.AllowSorting(true)
.AllowResizing(true)
.AllowPaging(true)
.AllowGrouping(true)
.AllowTextWrap(true)
.AllowScrolling(true)
.AllowFiltering()
.EnableRowHover(true)
.AllowSelection(false)
.IsResponsive(true)
.FilterSettings(filter => { filter.FilterType(FilterType.Excel); })
.Columns(col =>
{
col.Field(x => x.EmployeeID).HeaderText("ID").Visible(false).Width(30).IsPrimaryKey(true).AllowResizing(false).Add();
col.Field(x => x.EmployeeCode).HeaderText("Code").Width(60).AllowFiltering(true).Add();
col.Field(x => x.EmployeeName).HeaderText("Employee Name").Template("<a rel='nofollow' href = '" + Url.Action("EditEmployee", "SCM", new { id = "{{:EmployeeID}}" , status = ViewContext.RouteData.Values["id"] }) + "' data-req = {{:EmployeeID}} class='EditEmployee'>{{:EmployeeName}}</a>").Add();
})
)
i am unable to retrieve the primary key of the model to pass it as "id" parameter of my controller method, while using .Templete() method in grid column.
This is the rendered URL. http://localhost:64177/SCM.mvc/EditEmployee/{{%3aEmployeeID}}.
IT SHOULD HAVE PRIMARY KEY AS "id" PARAMETER.
Any help is appriciated
Thanx
Saud Nasir