Dot Net News: First Experience with ASP.NET in DWMX

This tutorial details the steps of building a basic ASP.NET vb application with the new DreamWeaver MX from the perspective of an experienced UltraDev 4 user. In this example we will build a simple news content management application. This tutorial covers ASP.NET objects, controls, and ASP.NET security as well as the issues I encountered working with ASP.NET VB pages in DWMX.

Front End

When you begin your asp.net Master/Detail page set you will find the Insert > Master/Detail menu item is grayed out. This means you will have to make these pages without UltraDev automating the process for you.

The Master Page

Open a new file. Select ASP.NET VB from the “Dynamic Page:” list box. From the server bindings drop down, select Dataset. This will open the familiar interface used to define a recordset. The only difference you’ll notice is the “On Failure, Goto:” text box. Also a collection of data is called a dataset in ASP.NET. Name your dataset or use the default as I did and select all from the “tbl_New” Table. Click “Test.” Save the file as asp/default.aspx. If you look in the code view now, you will see the DreamWeaverMX ASP.NET dataset code.  Now you can drag and drop dataset fields into your page as usual. At the top of the page create a table with one row and one column. Type in “Site News.” Highlight the text and select “Show Region > Show if Dataset is Not Empty” from the Server Behaviors drop down. Now add “No News” and apply the “Show Region > Show if Dataset is Empty” SB.

Create another table, two rows, one column. Drag the N_headline field and the N_ID fields into the first row. Highlight the field with the value N_headline and make a new link. In the new link URL dialog type “news_details.aspx?N_ID=”  then change to code view. Select and cut the dataset “N_ID” field and paste it into the link between the equal (=) sign and the double quote (). It should look this when you are done:

<a href="news_details.aspx?N_ID=<%# DataSet1.FieldValue("N_ID", Container)%>"><%# DataSet1.FieldValue ("N_headline", Container)%></a>

As you guessed this links to the details page. In the second row of your table type “Posted:” and drag the date field from the data bindings palette into position behind the colon. Select your table and add the “Repeat Region” SB. From the “Insert > Application Objects” sub menu select “DataSet Navigation Bar.” Save the file and you’re almost done.

There’s one more thing you have to do with a DWMX ASP.NET vb site before you can run the page: deploy the support files. Select “Site > Deploy Supporting Files…” and the Deploy Supporting Files dialog will appear. Select the root folder of your web and click “Deploy.”  The DreamweaverCtrls.dll will be copied to the bin folder. Now--if you have an ASP.NET enabled server--you should be able to run the page.

The Details Page

From the “File > New” dialog select a new ASP.NET  VB page. Save the page as news_details.aspx. Select “DataSet Query” from the bindings drop down and create a new DataSet. Select all from New. On this page we need filtered results, so select “N_ID” from the “Filter” drop down and then the “=”  sign. We are using a query string to pass our N_ID value so you’ll select “URL Parameter” from the next drop down and type “N_ID” in the last field. (Remove quotes from query if you need to—as I did—in the “Advanced” window.) Click “OK” and save the page. Once again you’ll need to create a table—three rows, one column. Now drag the dataset fields into your table: N_headline in the top row, N_Date in second row, and N_paragraph in the final row. Apply any formatting you want, save the page and done.

Go back Download Tutorial

 

James Threadgill

James ThreadgillJames Threadgill has authored numerous tutorials on ASP and ASP.NET web development, published on such sites as the Dynamic Zones and MSDN Accademic Alliance. He co-authored the Sam's book Dreamweaver MX: ASP.NET Web Development.

James first began computer programming in 1995 while attending Alvin Community College. He completed a certificate of computer science program and an Associate of Arts degree at Alvin before going on to the University of Houston-Clear Lake where he was awarded a Bachelor of Science and a Master of Arts.

James publishes fiction, poetry, and visual arts under the name Wayne James. His fiction first appeared in Raconteur in 1995 and since has been published numerous times: in Hadrosaur Tales 5 and 7, Bayousphere, and in the Write Gallery e-zine. His poetry first appeared in the small press magazine Lucidity in 1996 and has been published numerous times since. His collection of fiction and poetry, When Only the Moon Rages, was released in 2000. Most recently his work appeared in Tales of the Talisman winter 2010 and spring 2011 issues. James currently attends graduate school at the University of Houston and owns and operates small web design and internet marketing firm, WWWeb Concepts, with his wife, Karen, in Houston, TX USA.

See All Postings From James Threadgill >>

Comments

Can't get the validation working...

July 15, 2002 by Roy Barrow

Keep getting "Expected End of Statement" errors on load... Debugging shows a problem with the semi-colon in the OnChange call.

Help?

RE: Can't get the validation working...

July 20, 2002 by James Threadgill
Use my Form Validation Tool Kit extension You can get it here:  http://www.ebconcepts.com/asp/dwmx_extensions.asp

How do I make linebreaks?

August 12, 2002 by Peter Elkjaer

Great application, but it really needs to make <br>'s when hitting "enter".

I tried
<%
string mystring = MyTextBox.Text.Replace("\r\n", "<br>");
%>
but no luck.

How would you do that?

error

September 17, 2002 by James Leech

What does this mean:

unable to find script library '/aspnet_client/system_web/1_0_3705_0/WebUIValidation.js' Try placing this file manually or reinstall by 'running aspnet_regiis -c'

I get it when trying to browse the backend validation stuff.

See all 10 Comments

You must me logged in to write a comment.