The ASP.NET Web Matrix project makes ASP.NET development easy. With ready-to-go pages, code builders, a visual design environment, and other useful features, Web Matrix is a very complete Web development tool that gets you going within minutes. Because it is freeware from Microsoft and the download is only 1.2 MB, there is nothing stopping you from experimenting with it.
by Michiel van Otegem
May 9, 2003
Page 3 of 4
Figure 5: View of a database after adding it to the Workspace.
In the Workspace window you have access to the file system, FTP locations, and databases. It has three tabs: Workspace, Data, and Open Items. In my opinion, Open Items is somewhat superfluous since you can access all open items through the Window menu. If you work with a lot of files, though, Open Items can be usefulespecially because Web Matrix does not work on the basis of a project like Visual Studio .NET does, but rather on single files. The Workspace normally gives access to the hard-drives on your system, but through the Workspace menu item you can also add FTP connections. Once you've added an FTP connection you can work with the files on the remote location just as if they are on your local drive. Although this all works fine, you must recreate all FTP connections when you restart the application, which can become cumbersome.
Web Matrix enables you to expose a database table on the Web in less than a minute.
The Data tab gives you access to SQL Server or MSDE databases, and it enables you to create new databases, change existing databases, or view and edit data in a database. Unfortunately the Data tab only lets you edit tables and stored procedures, so you can't change the security settings or add functions. When you add a new connection you will see the same dialog that you saw in Figure 3. When you've selected the database, Web Matrix will add the database to the Workspace as shown in Figure 5. You can then select tables and edit or query the table. You can also select a stored procedure and change it. The Data tab also lets you drag and drop a table onto a page, which automatically adds a SqlDataSourceControl to the page that provides a connection to the database, and an MxDataGrid control that displays the table you dragged onto the page. Microsoft created both controls specifically for Web Matrix, and they enable you to display data from a database without a single line of code. The MxDataGrid supports sorting and paging by default, so just dragging and dropping a table on to your page gives you a grid representation that you can sort and page through. Figure 6shows the default representation of the Territories table in the Northwind database after I dragged it onto the page changed absolutely nothing. Through the Property Grid you can change the representation as much as you like. You can remove fields, change their representation, change the colors, etc. This of course goes for any other control as well, but there is no control that does so much with so little effort. You can even change the underlying SQL statement so that you can change the data that is actually read from the databaseincluding JOIN expressions and more if you so desire.