开发者

How to add a <T> type argument to a function called from an MVC3 Razor View?

I've written a function to output an enum as RadioButtons in a group (based on code answers found on here...blatantly stolen!)

However, the function takes a type argument - and I can't work out how to call it from the View?

I've tried the two snippets below...the first works correctly, but doesn't output anything, and I can't work out how to get the second to t开发者_StackOverflow中文版ake ?

@{
    Html.RadioButtonForEnum<RuleType>("Rule");   
}

@Html.RadioButtonForEnum<RuleType></RuleType> <--this gets autocompleted for me!

I've a feeling this is going to be simple...!


Sounds like you need to make your code block explicit. Try:

@(Html.RadioButtonFor<RuleType>("Rule"))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜