ASP.NET 4.5 webforms

4,473 views
4,365 views

Published on

Describes latest changes on asp.net 4.5.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,473
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
64
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

ASP.NET 4.5 webforms

  1. 1. ASP.NET 4.5 Web FormsNew features Brij Bhushan Mishra MVP-ASP.NET/IIS http://brijbhushan.net @brij_bhushan
  2. 2.  Earlier Version’s Data Control Strongly typed data controls Model Binding ◦ Selecting data ◦ Filtering Data ◦ Custom value Provider ◦ Editing Data ◦ Validations ◦ Custom validation Support for HTML Encoding
  3. 3.  Data controls in earlier versions  Late bound Eval/Bind methods  Does not provide navigational support  Missing Compile time checking
  4. 4.  ASP.NET 4.5 introduces ItemType property with Data controls ◦ Now define the type of model to your data controls ◦ Item will be strongly coupled with model ◦ Provides intellisence support, compile time checking and navigational support as well ◦ There are two new typed variable introduced that is used in Data-binding expressions Item and BindItem. ◦ Item is used in one-way data-binding expressions while BindItem is used two way binding
  5. 5.  One way binding – Two way Binding
  6. 6.  Assign a property SelectMethod with the public method name written at code behind ◦ It should return IEnumerable or IQueryable object
  7. 7.  Automatically binds the data to the control No need to assign the DataSource property and no need to call DataBind method Automatically supports Paging and sorting ◦ Handled by the SQL server with the help underlying LINQ provider
  8. 8.  Can have filtering parameters in Select Method Parameters fetch value from the given Value providers. Some value providers are ◦ Query string ◦ Session ◦ Cookies ◦ Controls ◦ Form Values etc We can write custom Value Providers as well.
  9. 9.  Create your own value provider by implementing IValueProvider interface ◦ GetValue method should return an object of type ValueProviderResult which should contain the value
  10. 10.  Create your own custom attribute by Implementing ValueProviderSourceAttribute Override GetValueProvider which should return the instance of CustomValueProvider
  11. 11.  Data controls provide the following Properties to support this feature ◦ InsertMethod ◦ UpdateMethod ◦ DeleteMethod
  12. 12.  Model Binding supports Validation with the help of Data Annotations from System.ComponentModel.DataAnnotations namespace
  13. 13.  If your control is model bound on the Type these validation rules are fired Page object has a new ModelState property ◦ ModelState.IsValid returns true if there is no validation errors ◦ Provide list of all errors
  14. 14.  ASP.NET introduced new Property ‘ShowModelStateErrors’ in ValidationSummary control. Display all the model validation errors
  15. 15.  Can write your custom validation attribute by implement ValidationAttribute Override IsValid method write the validation logic in it.
  16. 16.  ASP.NET 4.5 provides support to encode the data in data binding expressions. Add a colon (:) to the end of the <%# prefix that marks the data-binding expression

×