Main Menu
Contact Us
Earn Money
Earn money online, For lifetime Hashdot membership and for Advertisement details..
Click Here
Click Here
Login
<div align="justify"><p><u><b>HTML Editors</b></u>
</p><p><b>Working with ASP.NET</b>
</p><p>Macromedia Dreamweaver MX: Developers, you'll notice that when working with the ASP.NET server model there is no menu option to create a dynamic list/menu. Here's the three-step solution:
Notice that when working with the ASP.NET server model, there is no menu option to create a dynamic list/menu.
<b>Here's the three-step solution:</b> </p><p>i) Create a blank page with the language set to VB or C#, depending on what was selected when defining the site. </p><p>ii) Create a database connection by clicking on Windows/Databases. In the Database panel, click the "+" button and choose OLE DB Connection. Assign a name to your Connection. Click on Templates, and then select Microsoft
Access 2000 (Microsoft Jet 4.0 Provider). Fill in the necessary information for your connection, such as the path to your MS Access database. You will need to modify the connection information so that it looks similar to the following: </p><p>Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=[databaseName];
User ID=[username];
Password=[password];
Fill in the information similar to the following:
Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=C:\databases\mydatabase.mdb;
C:\databases is the path where the database is located on the remote server. Note that if there is no username and password required to access the database, the User ID and Password fields can be deleted. </p><p>Finally, click the 'Test' button to test your connection and then click OK if it tests successfully.
iii) Next, create the DataSet by clicking on Windows/Bindings. In this example, the DataSet is named DataSetDropDown. See the sample code below:
Add
on the page where you want to add the list/menu. Insert the asp:dropdownlist object between the and tags. This object is located in the Insert > ASP.NET Objects menu.
Insert the asp:dropdownlist and then click on Data to see a dialog box.
You need to enter the DataSource, DataTextField and DataValueField information into each field. For testing purpose, you should enter the information into your Data dialogue box.
Save the page and preview in the browser or view Live Data. The list/menu should be populated with data from the database.
The source code of your final page should look close to the following:
DataMember="datamember"
DataSource=""
DataTextField="LASTNAME"
DataValueField="EMPLOYEEID"
ID="dropdownlistid" runat="server">
Here are the definitions of each property listed in code example:
DataMember: When binding data, this attribute specifies the table of a DataSet to use. </p><p>DataSource: When binding data, this attribute specifies the data source to use. </p><p>DataTextField: When binding data, this attribute specifies the field to use for item text values. </p><p>DataValueField: When binding data, this attribute specifies the field to use for values of item-value </p><p><img src="http://www.hashdot.com/a.jpg" width="510" height="383" border="0" alt="" /> </p></div>
Notice that when working with the ASP.NET server model, there is no menu option to create a dynamic list/menu.
<b>Here's the three-step solution:</b> </p><p>i) Create a blank page with the language set to VB or C#, depending on what was selected when defining the site. </p><p>ii) Create a database connection by clicking on Windows/Databases. In the Database panel, click the "+" button and choose OLE DB Connection. Assign a name to your Connection. Click on Templates, and then select Microsoft
Access 2000 (Microsoft Jet 4.0 Provider). Fill in the necessary information for your connection, such as the path to your MS Access database. You will need to modify the connection information so that it looks similar to the following: </p><p>Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=[databaseName];
User ID=[username];
Password=[password];
Fill in the information similar to the following:
Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=C:\databases\mydatabase.mdb;
C:\databases is the path where the database is located on the remote server. Note that if there is no username and password required to access the database, the User ID and Password fields can be deleted. </p><p>Finally, click the 'Test' button to test your connection and then click OK if it tests successfully.
iii) Next, create the DataSet by clicking on Windows/Bindings. In this example, the DataSet is named DataSetDropDown. See the sample code below:
Add
on the page where you want to add the list/menu. Insert the asp:dropdownlist object between the and tags. This object is located in the Insert > ASP.NET Objects menu.
Insert the asp:dropdownlist and then click on Data to see a dialog box.
You need to enter the DataSource, DataTextField and DataValueField information into each field. For testing purpose, you should enter the information into your Data dialogue box.
Save the page and preview in the browser or view Live Data. The list/menu should be populated with data from the database.
The source code of your final page should look close to the following:
DataMember="datamember"
DataSource=""
DataTextField="LASTNAME"
DataValueField="EMPLOYEEID"
ID="dropdownlistid" runat="server">
Here are the definitions of each property listed in code example:
DataMember: When binding data, this attribute specifies the table of a DataSet to use. </p><p>DataSource: When binding data, this attribute specifies the data source to use. </p><p>DataTextField: When binding data, this attribute specifies the field to use for item text values. </p><p>DataValueField: When binding data, this attribute specifies the field to use for values of item-value </p><p><img src="http://www.hashdot.com/a.jpg" width="510" height="383" border="0" alt="" /> </p></div>

