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.
Of late I havent been blogging much because of my extensive travel and meeting developer and architect folks across the country. But I couldnt resist further before writing on ASP.NET "Futures" If you have been to the http://www.asp.net/ajax/downloads/ site and bothered to scroll down a bit, you would have noticed that there is an "ASP.NET Futures (July 2007)" CTP Download link.
ASP.NET "Futures" has an exciting bunch of controls and features that would make web developers' life pretty cool. This build also combined ASP.NET AJAX "Futures" which was earlier a separate download. So, what is there in it for you if you are a web developer?
ASP.NET "Futures" gives you an early technology preview of the features currently being considered for future versionf of ASP.NET and .NET Framework. The first and foremost thing that would strike you is Dynamic Data Controls which can change the way we develop Data Driven Websites today.
Then you have Silverlight Controls for ASP.NET - XAML Control and the Media Control which help you host the respective contents on an ASP.NET Page without writing any script manually.
ASP.NET Application Services which allow you to integrate search within your websites and configure custom search providers just by configuring it and also the ability to use dynamic site maps.
ASP.NET AJAX Futures which include History Support for Back Button, DragOverLayerExtender and bunch of other cool stuff that helps you create richer AJAX Applications.
Dynamic Language Support that enables you to use DLR and Dynamic languages within ASP.NET in addition to the regular .NET Languages.
All of these work with Visual Studio 2005 and you dont need to wait till Visual Studio 2008 to start experimenting these.
My subsequent articles will focus on each of the new features as it would require one post each and I am sure it would benefit you if you are an ASP.NET Developer.