BoldDeskWe are launching BoldDesk on Product Hunt soon. Learn more & follow us.
[CSHTML] <script type="text/x-jsrender" id="customerTemplate"> <a rel='nofollow' href="CustomerDetails?OrderID={{:OrderID}}">{{:CustomerID}}</a> </script> @(Html.EJ().Grid<GridActionLink.OrdersView>("FlatGrid") .Columns(col => { col.HeaderText("Customer ID").Template("#customerTemplate").Width(80).Add(); }) ) public ActionResult CustomerDetails(long OrderID) { //Write your code here return View(); |
Hi Carlos,
Thanks for using Syncfusion products.
Query: It is possible to add de column templante html.actionlink?
We would like to let you know that, it is not possible to render the jsrender templates by using Html.ActionLink reouteValues due to its server side object values. We suggest you to use html anchor tags instead of Html.ActionLink to resolve the issue. Please refer the below code snippet for further details.
[CSHTML] <script type="text/x-jsrender" id="customerTemplate">
<a rel='nofollow' href="CustomerDetails?OrderID={{:OrderID}}">{{:CustomerID}}</a>
</script>
@(Html.EJ().Grid<GridActionLink.OrdersView>("FlatGrid")
.Columns(col =>
{
col.HeaderText("Customer ID").Template("#customerTemplate").Width(80).Add();
})
)
[CS]public ActionResult CustomerDetails(long OrderID)
{
//Write your code here
return View();
}
Note: We have analyzed your code snippet and found that you have used ClientTemplate in Grid column properties. For your kind information there is no such property under columns in the Grid.
For your convenience we have created a simple sample and the same can be downloaded from the below link.
Sample Link: http://www.syncfusion.com/downloads/support/forum/118954/Sample2064567500.zip
Please let us know if you have any concerns.
Regards,
Ajith R
Hi Support,
I am using custom action link method to encrypt all my route values.
If I use HTML anchor tag means, how to encrypt my route values.
Can you give me the solution to encrypt route values
@(Html.EJ().Grid<object>("FlatGrid")
.Datasource((IEnumerable<object>)ViewBag.dataSource)
.AllowPaging()
. . .
.Columns(col =>
{
. . .
col.Field("Freight")
.HeaderText("Freight")
.Template("<a class='clas' rel='nofollow' href='/Home/Index.cshtml?ID={{:Freight}}'>{{:Freight}}</a>").Add();
})
) |
@(Html.EJ().Grid<object>("FlatGrid")
.Datasource((IEnumerable<object>)ViewBag.dataSource)
.AllowPaging()
.Columns(col =>
{
col.HeaderText("Edit")
.Template("<a>Click Me</a>").Add();
})
.ClientSideEvents(e => e.TemplateRefresh("templateRefresh"))
)
<script>
function templateRefresh(args) {
$(args.cell).find("a").attr("rel='nofollow' href","/Home/Index?ID="+args.data.OrderID+"")
}
</script> |