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