Passing a JavaScript variable to a helper method

Posted by Brendan Vogt on Stack Overflow See other posts from Stack Overflow or by Brendan Vogt
Published on 2011-02-24T07:01:10Z Indexed on 2011/02/24 7:24 UTC
Read the original article Hit count: 243

I am using ASP.NET MVC 3 and the YUI library.

I created my own helper method to redirect to an edit view by passing in the item's ID from the Model as such:

window.location = '@Url.RouteUrl(Url.NewsEdit(@Model.NewsId))';

Now I am busy populating my YUI data table and would like to call my helper method like above, not sure if it is possible because I get the item's ID by JavaScript like:

var formatActionLinks = function (oCell, oRecord, oColumn, oData) {
   var newsId = oRecord.getData('NewsId');
   oCell.innerHTML = '<a href="/News/Edit/' + newsId + '">Edit</a>';
};

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about ASP.NET