Hello,
I would like to use ClientTemplate in a Grid column. I want to create html link in one of those column. I am not sure how declare and pass a variable of the Model that I am passing into the grid. I am trying to pass the variable ID and the name for the link as variable. model => model.IDString contains the id that is being passed to link and name of the link is represented in model => model.ViewImage.
Here is the piece of code I am using.
<div id="SearchResultGrid">
@(Html.Kendo().Grid(Model)
.Name("ExampleGrid")
.Columns(columns =>
{
columns.Bound(model => model.IDString).Title("ID");
columns.Bound(model => model.ViewImage).Title("View Image").ClientTemplate(model =>(
"<a href='/Example/ExampleDocument.aspx?Id=" + model.IDString + "' >" + model.ViewImage + "</a>")
);
})
.Pageable()
.Sortable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(10)
.ServerOperation(false)
.Sort(sort =>
{
sort.Add(model => model.Created).Descending();
})
)
.BindTo(Model)
.Reorderable(reorder => reorder.Columns(true))
)
</div>
Can you give me an example of how declare the variable for this action link.
Following line works well for a server action
columns.Template(model =>(
"<a href='/Provider/ProviderCorrespondenceDocument.aspx?CorrespondenceId=" + model.IDString + "' >" + model.ViewImage + "</a>")
);
I would like to use ClientTemplate in a Grid column. I want to create html link in one of those column. I am not sure how declare and pass a variable of the Model that I am passing into the grid. I am trying to pass the variable ID and the name for the link as variable. model => model.IDString contains the id that is being passed to link and name of the link is represented in model => model.ViewImage.
Here is the piece of code I am using.
<div id="SearchResultGrid">
@(Html.Kendo().Grid(Model)
.Name("ExampleGrid")
.Columns(columns =>
{
columns.Bound(model => model.IDString).Title("ID");
columns.Bound(model => model.ViewImage).Title("View Image").ClientTemplate(model =>(
"<a href='/Example/ExampleDocument.aspx?Id=" + model.IDString + "' >" + model.ViewImage + "</a>")
);
})
.Pageable()
.Sortable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(10)
.ServerOperation(false)
.Sort(sort =>
{
sort.Add(model => model.Created).Descending();
})
)
.BindTo(Model)
.Reorderable(reorder => reorder.Columns(true))
)
</div>
Can you give me an example of how declare the variable for this action link.
Following line works well for a server action
columns.Template(model =>(
"<a href='/Provider/ProviderCorrespondenceDocument.aspx?CorrespondenceId=" + model.IDString + "' >" + model.ViewImage + "</a>")
);