How to pass Knockout property to Razor helper?

233 Views Asked by At

I have the following link in my view:

<a href="@Url.RouteUrl("Item", new { SeName = item.ItemSeName })">LinkText</a>

I'm using Knockout and trying to replace the code above with something like:

<a data-bind="text: LinkText, attr: {href: '@Url.RouteUrl("Item", new { SeName = ItemSeName })'}"></a>

ItemSeName is the property of my KO view model.

How can i pass this property value to @Url.RouteUrl helper, to the routevalues object?

1

There are 1 best solutions below

1
On

Razor is server-side, knockout is client-side. It's not going to work how you'd like.