Monday, February 4, 2008

Dig into Data Source

Data Source (Object Data Source and Sql Data Source) in .net 2.0 includes free sorting and paging. Here is a very good example the benefit of using data source.
http://damianpedwards.spaces.live.com/blog/cns!A079DE667E1958B3!562.entry

Using Data Source we can use CSS friendly to structure and display our sorting and paging nicely.


However there is overhead when you implementing AJAX type of work.
  1. DataSource will trigger your select method, everytime, it is postback.
    If you use Data binding using data table / other data source , you can control manually so that it only bind when you need to refresh your data or there is data changes.

  2. Object Data Source is isolated from your page control. because It create a new instance of data source every time it postback. so you can not share your data into your page control. If you want to share you need to share it using session/ cache. View state/ class variable can not be shared.

No comments: