Dynamic Data Controls - ASP.NET "Futures" July 2007 CTP

Following my earlier post, here is my first post on Dynamic Data Controls in ASP.NET "Futures" July 2007 CTP.  Once you install ASP.NET "Futures" from http://www.asp.net/ajax/downloads/ (scroll down to the bottom and you would find the download link) you would get a set of new templates "ASP.NET Futures Website" and "Dynamic Data Website" when you select "File - New - Website" in Visual Studio 2005 or Visual Studio 2008 Beta 2.

Once you select "Dynamic Data Website" template it creates a Dynamic Data Website with the default configuration settings required to run the website.  Hold on.. here is where things change from the normal way you create Data Driven Websites.

The first step in creating a Dynamic Data Website is to configuring a connection string.  You can use your regular connection string that connects to SQL Server Database and add it to the connectionStrings collection in the web.config file.

Now..normally you would start creating your pages and add Data Controls and bind them through the WSIWYG editor. 

In case of Data Driven Website, you still create pages but with a little difference.   The Page name or Webform name is mapped to your table name in the Database (this setting can be overridden in the config file but for sample purposes we use this default behaviour).  So lets start doing that.  Just to reiterate the steps I am starting from the scratch.

1. Fire up Visual Studio 2005 or Visual Studio 2008 Beta 2 and select "File - New - Website" and select "Dynamic Data Website" template and create it. (if you dont find this template you may have installed ASP.NET "Futures" before installing Visual Studio 2008 Beta 2 and the resolution is to uninstall ASP.NET "Futures" and install it again)

2. Pick up your connection string and add it to the connectionstrings.  Note that you can have as many connection strings and can map the connectionstring to use at the dynamicData settings of the web.config file (I will come to this later)

3. Start creating page by selecting "Add - New Item - Dynamic Data Webform" and unselect "Place codebehind file".  This creates it as a standalone Webform.  Provide the name your Database Table name say "Products" and then click ok.

4. Once you have created your page, you would find that by default there is a "DynamicAutoData" control in the page.  You can remove it for the moment and go to ToolBox and under "ASP.NET Futures - Dynamic Data Website" select the DynamicList control and add it to the page.

5. Normally the logical step is to connect it to the database table and configure columns, but for a change hit f5 and run it as is

6. It would take a moment for the first time to create the database schema cache and then should start rendering the page

7. Voila, you see that the data from the table (Products - in this case) is represented with a neat gridview with paging, sorting, editing, deleting all enabled automatically.

How does this work?  Hold on until my next post where I explain this and also talk about the other Dynamic Data Controls.

Cheers !!!

Print | posted on Wednesday, October 31, 2007 7:25 PM

Comments on this post

# re: Dynamic Data Controls - ASP.NET "Futures" July 2007 CTP

Requesting Gravatar...
The data could not be loaded into the paper side.
Left by Karodu on Dec 13, 2007 11:10 PM

# re: Dynamic Data Controls - ASP.NET "Futures" July 2007 CTP

Requesting Gravatar...
Thanx a lot, It is just gr8 really this post helped me a lot. And I am waiting for next one.
Left by Ankur Sharma on Sep 18, 2008 3:56 PM

# re: Dynamic Data Controls - ASP.NET "Futures" July 2007 CTP

Requesting Gravatar...
can u tell me how to do the dynamic data control for a specific date, and that date can be selected by Calendar...
Left by Archana on Jan 29, 2009 12:01 PM

# re: Dynamic Data Controls - ASP.NET "Futures" July 2007 CTP

Requesting Gravatar...
this is a very good post. I will share with friends
Left by nail polish on Apr 11, 2010 11:00 AM

# re: Dynamic Data Controls - ASP.NET "Futures" July 2007 CTP

Requesting Gravatar...
The post is very nicely written about Dynamic Data Controls and ASP.Net Futures. I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement. Thanks for sharing with us.
Left by Computer Flat Screen Monitors on Apr 19, 2010 7:18 AM

# re: Dynamic Data Controls - ASP.NET "Futures" July 2007 CTP

Requesting Gravatar...
I think if you set the AllowCustomPaging=true, the error will disappear but you will only be able to see the first set of records and will be unable to implement the built-in paging functionality provided by the DataGrid. Thanks
Left by Body Core Strength on Apr 19, 2010 7:29 AM

Your comment:

 (will show your gravatar)