ASP.NET MVC Html.TextBox 报 Object reference not set to an instance of an object 的解决方案

Control中代码如下:

 

UserController

 

关键是要加: ModelState.SetModelValue("UserName", collection.ToValueProvider()["UserName"]);

posted @ 2009-07-14 16:05  消失的风  阅读(...)  评论(...编辑  收藏