Sensors and network administering


asp.net datagrids in dreamweaver 8

In this article you will be able to use theConnection  string  settings.
new features of dreamweaver 8 to connect to a
SQL database and return the results to aNext, 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 applicationLook 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 DataSetData  Source=NameOfYourDatabaseServer;
for the DataGrid, and create a default
DataGrid. In thefollowing three articles, youInitial Catalog=Northwind;User
will build on what you learn in this articleID=sa;Password=;"  />
and learn how to customize the DataGrid
appearance,  make  theYou 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 willUsing the new page you created prior to
be comfortable working with DataGrids anddefining the database connection, save the
will befamiliar with their various featurespage  as  employees.aspx
and  attributes.
In the Application panel, click the Server
This article uses the DataSet tag to obtainBehaviors  tab.
the data from the sample Northwind database
included with SQL Server 2000 and display itThe file DreamweaverCtrls.dll must reside in
in  athe /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 sitelink within the Server Behaviors tab. This
definition.will  copy  the
Select Site > New Site... from the Menu barDreamweaverCtrls.dll file into the
to  create  a  new  site.appropriate  directory.
On the Basic tab, enter the followingNext, click the plus button and select
information, clicking Next at the bottom ofDataSet.
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 atSelect dbo.Employees from the Table pop-up
C:Inetpubwwwroot.menu.
URL  to  browse  to  the  root  of your siteSelect 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 yourcontains 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 yourEmployeeID, LastName, FirstName, HireDate,
site's name from the list, and click the EditAddress,  City,  Region,  PostalCode,
button.
Country,  HomePhone
Set up the testing server to use ASP.NET C#
as the Server Model. Set the Access and otherSince you don't need to filter the query, set
values  as  appropriate  for  your  siteFilter  to  None.
Now we need to create a connection to the SQLSince 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 theClick  OK  to  create  the  DataSet.
General tab, select Dynamic Page for the
Category  andSave  your  work.
ASP.NET C# for the Dynamic Page type. ClickNow 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 Dreamweaverto be returned you will need to create a
needs to knowwhat kind of server technologydatagrid to display the information in a
your pages will use before it can help you intabular  form.
the  create  a  database  connection
Open the Server Behaviors tab of the
Open the Databases tab of the ApplicationApplication  panel.
panel  group.
Select the plus button again, and select
Click the plus button, and select the SQLDataGrid.
Server Connection option.when the SQL Server
Connection dialog box appears, type in theName  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 withClick  OK  to  create  the  DataGrid.
Microsoft SQL Server, so set this to
Northwind.Save  your  work.
User ID: The default user name for MicrosoftTo see your page in action, view the page in
SQL Server that is created at the time ofLive 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 upNow that you know how to create DataSets and
your connection correctly. If an errorhow to create the default display for the
occurs,  check  yourDataGrid using the data in those datasets.



1 A B C 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95