Attention: We are retiring the ASP.NET Community Blogs. Learn more >

Contents tagged with Model Binding

  • Using Value Providers in ASP.NET 4.5

    ASP.NET 4.5 Web Forms support model binding. A part of the overall model binding features are Value Providers. A value provider grabs values from a request and binds those values with method parameters. ASP.NET provides several inbuilt value providers and also allows you to create your own. This article discusses what value providers are with examples. It also shows how a custom value provider can be created.

  • Validating Multiple Data Model Properties

    In my previous article I wrote about displaying model state errors inside databound controls such as GridView. In that example we used data annotation validators to perform the validations. While data annotation validators do their job quite well they are inherently applied to only one data model property at a time. For example, the [StringLength] or [Required] attributes validate only one property under consideration. However, sometimes your validation rule involves multiple data model properties. In such cases data annotation validators won’t be of much use. Luckily there are other validation techniques that can come to your rescue.

  • Displaying Model State Errors Inside GridView Columns

    ASP.NET 4.5 web forms support model binding features. Additionally they can make use of model validation using data annotation validators. The validation errors thrown by data annotation validators can be easily displayed in a web form using ValiationSummary control. While this arrangement works great, at times you want something customized. This article shows how model errors can be displayed inside a GridView column. You can use similar technique for other databound controls such as DetailsView and FormView.

  • GridView Paging with Skip() and Take()

    Paging is one of the most commonly used features of ASP.NET GridView control. ASP.NET 4.5 model binding features allow you to bind a GridView with data returned by a custom method. This method is specified using the SelectMethod property and can make use of LINQ and Entity Framework to fetch data. Additionally, it allows you to implement custom paging. This article shows how.