The following code is working fine in development, as soon as i deploy in web server it said could find file directory. I need to change the .client template so its not hard coded like before. So if we deploy to the server where the Top folder name different or the hierarchy change, it still find the page.
I was thinking using @Url.Action but not sure how in this case to implement in .CLientTemplate
columns.Template(@<text>
@Html.ActionLink(@item.FirstName, "Index", "Summary", new { testId = @item.FirstName })
</text>)
.ClientTemplate("<a href='/Summary/Index/?testId =#= TestId #'>#=FirstName#</a>").Title("First Name");
Something like this should do:
.ClientTemplate("<a href='" + Url.Action("Index", "Summary", new { testId = "#=TestId#" }) + "'>#=FirstName#</a>")
I got this one working fine
columns.Bound(a => a.Id)
.Title("Action")
.Filterable(false)
.ClientTemplate(
"<a href='"
+ Url.Action("ActionName", "Controller")
+ "/#= Id #'"
+ ">View</a>"
);
I needed an extra column and a link button field for go to details page of a customer. I don't need filter option for this column and that is why I remove it using Filterable(false)
. Also you can give the link content and column header as above. This value "/#= Id #'"
is the one I pass to the controller action method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With