I'm trying to create my own html helper. I need to add some javascript to the string I return.
public static string ListCheckbox(this HtmlHelper helper, string actionName, int value)
{
return String.Format("<input type='checkbox' value='{1}' onclick='Action_{0}()'></input>", actionName, value);
}
How can I add this javascript, assuming that I want to keep this code in separate *.js file?
In *.cshtml file I can do it like that:
@Scripts.Render("~/Scripts/App/markSearched.js")
But this doesn't work in c# file. HtmlHelper helper variable doesn't have anything like "Scripts" or "Render". Can I use those function in c# class?