Asp.NET 4.5的新特性之一是改进了模型绑定方式(Model Binding)。通过借鉴ObjectDataSource和Asp.NET MVC的概念,Asp.NET 4.5扩展了模型绑定的方式,使程序员可更加方便地使用Asp.NET Web Form控件编写以代码为中心的数据访问程序。

在按照例子编写代码时发现一个小问题,在页面后台代码编写数据过滤方法时,Control属性并不被认可,提示System.Web.UI.Control不是特性类。如图:Asp.NET 4.5 数据绑定新特性 之 通过控件传值过滤数据 之注意事项

 

解决方法,在类前添加 using System.Web.ModelBinding;(http://msdn.microsoft.com/zh-cn/library/system.web.modelbinding.aspx) ,该命名空间里定义了ControlAttribute , CookieAttribute ,FormAttribute ,ProfileAttribute ,QueryStringAttribute ,SessionAttribute 等。

参考资料:

What's New in ASP.NET 4.5 and Visual Studio 2012 http://www.asp.net/vnext/overview/aspnet/whats-new

相关文章:

  • 2021-09-12
  • 2022-12-23
  • 2021-09-12
  • 2021-06-28
  • 2022-12-23
  • 2022-12-23
  • 2021-05-17
猜你喜欢
  • 2021-05-16
  • 2022-12-23
  • 2021-08-28
  • 2021-05-23
  • 2021-07-09
相关资源
相似解决方案