I have an Html Helper that generates a simple HTML table. I want to generate, in the same helper, some scripts to work on this table, like edit rows, reorder etc.
I already have these scripts, my question is:
How can I generate these scripts by my HTML Helper and put then at the end of the page?
I currently added the scripts at the end of html table, like an single string (Html of the table and the scripts) and printed it on the page, is there a better way to do this, any best practice for solve this problem?
For make the question clearer, here's my signature of the helper:
public static MvcHtmlString CustomTableRepository
(this HtmlHelper html, string idTable, Hashtable columns, string jsonRepo)
Where:
idTable: Id of the tag table
columns: The key/value of each th cell of the columns
jsonRepo: jSon repository, where I will take the values of my table and draw it