[英]How to add a <T> type argument to a function called from an MVC3 Razor View?
我已經編寫了一個函數來輸出一個enum作為一個組中的RadioButtons(基於此處找到的代碼答案......公然被盜!)
但是,該函數采用了一個類型參數 - 我無法弄清楚如何從View中調用它?
我已經嘗試了下面的兩個片段......第一個工作正常,但沒有輸出任何東西,我無法弄清楚如何讓第二個采取?
@{
Html.RadioButtonForEnum<RuleType>("Rule");
}
@Html.RadioButtonForEnum<RuleType></RuleType> <--this gets autocompleted for me!
我覺得這很簡單......!
聽起來你需要明確你的代碼塊。 嘗試:
@(Html.RadioButtonFor<RuleType>("Rule"))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.