我有一個Html Helper來生成一個簡單的HTML表格。我要生成,在相同的助手,有些腳本在此表上工作,像編輯行,重新排序等使用Html Helper在頁面末尾插入腳本
我已經有了這些腳本,我的問題是:
我怎樣才能產生這些腳本通過我的HTML助手,然後放在頁面的結尾?
我目前在html表格的末尾添加了腳本,就像單個字符串(表格和腳本的Html)並將其打印在頁面上,是否有更好的方法來執行此操作,解決這個問題?
爲了使問題更清楚,這是我的助手的簽名:
public static MvcHtmlString CustomTableRepository
(this HtmlHelper html, string idTable, Hashtable columns, string jsonRepo)
其中:
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