积极答复者
mvc2 中启用客户端验证出现异常的问题

问题
-
不知道为什么,在MVC2中启用了客户端验证
<script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftMvcValidation.js" type="text/javascript"></script>
<%Html.EnableClientValidation(); %>
然后就发生异常
异常详细信息: System.Collections.Generic.KeyNotFoundException: 给定关键字不在字典中。
如果不启用客户端验证,用服务器验证的话 正常.
<fieldset>
<legend>Fields</legend>
<div class="editor-label">
<%= Html.LabelFor(model => model.学号) %>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(model => model.学号) %>
<%= Html.ValidationMessageFor(model => model.学号)%> //这句话错误
</div>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
为什么呢?不支持中文?
淡叶到此一游
答案
-
喔!!我一直建议不要用中文。也没尝试过,中文不适合做这些。
建议换成英文(或者拼音字母/组合)试试看吧:)
Please mark the post answered your question as the answer, and vote other helpful posts, so they will appear differently to other users for the same problem. 请将解决实际问题的帖子标记为“答案”,并给其他有帮助的帖子投票,这样其他人有同样问题的时候可以快速找到解决方案。谢谢!- 已标记为答案 淡叶 2010年7月5日 6:00
全部回复
-
喔!!我一直建议不要用中文。也没尝试过,中文不适合做这些。
建议换成英文(或者拼音字母/组合)试试看吧:)
Please mark the post answered your question as the answer, and vote other helpful posts, so they will appear differently to other users for the same problem. 请将解决实际问题的帖子标记为“答案”,并给其他有帮助的帖子投票,这样其他人有同样问题的时候可以快速找到解决方案。谢谢!- 已标记为答案 淡叶 2010年7月5日 6:00