@Html.TextBoxFor解决思路

@Html.TextBoxForinput idDateBegin nameDateBegin typetext onclickWdatePicker({skin:blue

@Html.TextBoxFor


<input id="DateBegin" name="DateBegin" type="text" onclick="WdatePicker({skin:'blue',qsEnabled:false,maxDate:'#F{$dp.$D(\'DateEnd\')}'})"
                        class="Wdate" />


上边怎么用html helper表示

下边这么是错的
@Html.TextBoxFor(a => a.DateBegin,{onclick="WdatePicker({skin:'blue',qsEnabled:false,maxDate:'#F{$dp.$D(\'DateEnd\')}'})",
                        class="Wdate" })
[解决办法]
{} 前面加new ,new {} 是 匿名对象的 申明方式, class 前面加 @ 因为class与C# 关键字 冲突.

引用:

    @Html.TextBoxFor(a => a.DateBegin, new  {onclick="WdatePicker({skin:'blue',qsEnabled:false,maxDate:'#F{$dp.$D(\'DateEnd\')}'})",@class="Wdate" })