| In this article you will be able to use the new | | | | correctly. If an error occurs, check your |
| features of dreamweaver 8 to connect to a SQL | | | | Connection string settings. |
| database and return the results to a datagrid. | | | | Next, click OK to accept the connection settings. You |
| We will show you how to create full-featured, | | | | will now see the Northwind connection appear in the |
| customized DataGrids using Macromedia | | | | Databases tab of the Applicationpanel group. |
| Dreamweaver 8 on the ASP.NET application server | | | | Look at web.config in your site's root directory. |
| platform. | | | | Notice that Dreamweaver has added several new |
| You will set up your Dreamweaver MX site, connect | | | | lines under the element:element: |
| to the database, create the DataSet for the | | | | Data Source=NameOfYourDatabaseServer; |
| DataGrid, and create a default DataGrid. In | | | | Initial Catalog=Northwind;User ID=sa;Password=;" /> |
| thefollowing three articles, you will build on what you | | | | You will now need to create the DataSet that you |
| learn in this article and learn how to customize the | | | | will use for the DataGrid data source. |
| DataGrid appearance, make the | | | | Using the new page you created prior to defining the |
| DataGrid editable, and sort columns in the DataGrid. | | | | database connection, save the page as |
| By the end of the article, you will be comfortable | | | | employees.aspx |
| working with DataGrids and will befamiliar with their | | | | In the Application panel, click the Server Behaviors |
| various features and attributes. | | | | tab. |
| This article uses the DataSet tag to obtain the data | | | | The file DreamweaverCtrls.dll must reside in the /bin |
| from the sample Northwind database included with | | | | directory under the root of your website. This file is |
| SQL Server 2000 and display it in a | | | | required by the ASP custom tagsprovided by |
| DataGrid. | | | | Dreamweaver MX. If you haven't already done so, |
| Firstly you will need to set up your site definition. | | | | click the deploy link within the Server Behaviors tab. |
| Select Site > New Site... from the Menu bar to create | | | | This will copy the |
| a new site. | | | | DreamweaverCtrls.dll file into the appropriate |
| On the Basic tab, enter the following information, | | | | directory. |
| clicking Next at the bottom of each screen: | | | | Next, click the plus button and select DataSet. |
| Enter a title in the Name field. | | | | The DataSet dialog appears. Name the DataSet |
| Yes, I want to use a server technology. Select | | | | ds_list. |
| ASP.NET C# as the server technology. | | | | Select Northwind from the connection pop-up menu. |
| Edit and test locally, storing your files at | | | | Select dbo.Employees from the Table pop-up menu. |
| C:Inetpubwwwroot. | | | | Select the Selected: radio button from the Columns: |
| URL to browse to the root of your site | | | | radio button group. |
| No, do not copy files when I am done editing. | | | | The Employees table in the Northwind database |
| Click Done to create an initial cache of your site. | | | | contains 18 columns. For this example, select the |
| Open the the Site Definition dialog box by choosing | | | | following 10 columns only (hold the Ctrl keywhile you |
| Site > Edit Sites. Select your site's name from the list, | | | | select each column): |
| and click the Edit button. | | | | EmployeeID, LastName, FirstName, HireDate, |
| Set up the testing server to use ASP.NET C# as the | | | | Address, City, Region, PostalCode, |
| Server Model. Set the Access and other values as | | | | Country, HomePhone |
| appropriate for your site | | | | Since you don't need to filter the query, set Filter to |
| Now we need to create a connection to the SQL | | | | None. |
| database. | | | | Since you want to sort alphabetically according to last |
| Within Dreamweaver, select File > New... from the | | | | name, so set Sort to LastName Ascending. |
| Menu bar to create a new file. On the General tab, | | | | Click OK to create the DataSet. |
| select Dynamic Page for the Category and | | | | Save your work. |
| ASP.NET C# for the Dynamic Page type. Click the | | | | Now you have created the connection to the |
| Create button to create the new page. This step is | | | | database and specified the data that you need to be |
| required because Dreamweaver needs to knowwhat | | | | returned you will need to create a datagrid to display |
| kind of server technology your pages will use before | | | | the information in a tabular form. |
| it can help you in the create a database connection | | | | Open the Server Behaviors tab of the Application |
| Open the Databases tab of the Application panel | | | | panel. |
| group. | | | | Select the plus button again, and select DataGrid. |
| Click the plus button, and select the SQL Server | | | | Name your DataGrid dg_list. |
| Connection option.when the SQL Server Connection | | | | Select the ds_list DataSet from the popup list. |
| dialog box appears, type in the information presented | | | | Show just four Records instead of the default 10 |
| below, and ensure that it matches your database's | | | | records. |
| User ID,password, and name. | | | | Leave the rest of the attributes at their default |
| Connection Name: Set this to Northwind. | | | | values for now. |
| Data Source: Set this to the name of your database | | | | Click OK to create the DataGrid. |
| server. | | | | Save your work. |
| Initial Catalog: You will be using the Northwind sample | | | | To see your page in action, view the page in Live |
| database that comes with Microsoft SQL Server, so | | | | Data preview (View > Live Data), or press the F12 |
| set this to Northwind. | | | | key to preview the page in your browser as shown |
| User ID: The default user name for Microsoft SQL | | | | in the illustration below. |
| Server that is created at the time of installation is | | | | The column headers are taken from the names of |
| SA, so set this to SA. | | | | the database columns. |
| Password: The default password for the SA account | | | | Now that you know how to create DataSets and |
| is blank, so leave this blank. | | | | how to create the default display for the DataGrid |
| Click the Test button in the SQL Server Connection | | | | using the data in those datasets. |
| dialog to ensure that you set up your connection | | | | |