Feed Icon  


  • Bryant Likes
  • Send mail to the author(s) E-mail
  • twitter
  • View Bryant Likes's profile on LinkedIn
  • del.icio.us
Get Microsoft Silverlight
by clicking "Install Microsoft Silverlight" you accept the
Silverlight license agreement

Hosting By

Hot Topics


Open Source Projects



WSV310 - ASP.NET: Programming with the Data Controls in ASP.NET "Whidbey" (Part 1)

Posted in at Wednesday, 29 October 2003 03:23 Pacific Standard Time

The goal of data controls in "Whidbey" is to make it easier to use data controls while at the same time add new features that make them better. Below are my notes on the session but I don't think I can do it justice. See the slide deck (link below) to get a better idea of how important these new features are.

Data Controls

  • Too hard in v1 (commonly requires 100s of lines of code)
  • Easy and powerful in Whidbey (do not require developer to understand the page lifecycle).
  • Goal: Common UI scenarios with little coding.

Types of Data Controls

  • Data Source Controls - represent backend data sources (ex: SqlDataSource control)
    • SqlDataSource - connection to database with select, update, etc.
      • Supports SqlClient, OleDb, ODBC, Oracle, etc.
      • Commands and stored procs
    • ObjectDataSource - BusinessObjects - select, update, etc point to methods on object
      • Binds to custom business objects
      • integrates with new Object Spaces
    • XmlDataSource - Xml Files
    • AccessDataSource - Access
    • DataSetDataSource - DataSets
    • SiteMapDataSource - connects to new ASP.NET sitemap
  • Data-Bound Controls - rendering data (ex: DataGrid control)

Data Source Controls

Retain the flexibility of v1 but add new benefits. Also easy to build your own data sources controls (ex: SalesFiguresDataSource). Two interfaces for doing this (plus two abstract classes)

  1. IDataSource
  2. IHierarchicalDataSource

New Data-Bound Controls

  • DetailsView
  • GridView
  • TreeView
  • Menu (Beta timeframe)
  • BulletedList

Sql Data Source Control

Responsible for sorting, paging, updating, inserting, deleting. In Beta 1 timeframe will persist the connection string to the web.config file and will be able to encrypt it. The data source controls was then demonstrated:

  1. Drag-and-Drop SQL table to page. It just works now. Showed some of the code (html) that makes this all work. Looks good.
  2. Turned on sorting/updating. Also just works. One cool feature was the new “move column“ feature where clicking a button moved a column without having to go into the property builder.
  3. Paging - done with the UI but can also be done via ExecutePagedReader with was seen in the ADO.NET session.
  4. Filtering - V1 made this hard, in Whidbey you don't need to code this.
  5. Parameter Types - ex. QueryStringParameter, ControlParameter, etc. These are very cool. Can then take these parameter types and associate them with a command (like select). All done in the HTML source. Very easy to add a dropdownlist to a page with a gridview and filter it using the dropdownlist. No code used.
  6. More events: OnSelecting, OnInserting, etc. These are for both data source and data-bound controls.

Object Data Source Control

  1. Select method can return any Object or IEnumberable list, collection, or array.
  2. Updates, inserts, deletes methods take individual fields.
  3. Many more features coming in Beta 1 timeframe. Wizards, designers, design-time support.
  4. A demonstration was done showing how to bind a datagrid and dropdownlist that both were bound to a business object. Selecting, sorting, paging, filtering, etc all done against middle tier object. Very cool!
  5. Can also bind data-bound controls using generics.

VS Data Component

A middle tier data access layer for Web and client. Seems like a DataAdapter that does everything better. Created from DB schema, sql, or sprocs, and does paging, fillby, and much much more.

ASP.NET Code Directory

Haven't seen this before. Basically it is a directory that you can drop class files into (cross-language supported) and the files will be compiled and can be referenced in your project. The demo showed a VB ASP.NET project and a CS file was dropped into the code directory and then the class was used in the pages.

Object Spaces

This is an object-to-relational framework that looks very promising. Mapping data to objects is a very common task.

  1. Map files, OSD, and RSD used to map the data to objects. (read: another xml format to learn) Thankfully they are generated by design time tools.
  2. Can do parameterized OPath query. (note o = object vs x = xml).
  3. ObjectDataSource can connect to object spaces as well.
  4. Also did a demo of how to create an ObjectSpacesDataSource object.

Overall it was a very good session. I'll be hitting part 2 for sure.

Slides at http://www.asp.net/whidbey....

Comments are closed.