ASP.NET Web Application Professor Ralph Westfall May 2011.

Slides:



Advertisements
Similar presentations
JQuery MessageBoard. Lets use jQuery and AJAX in combination with a database to update and retrieve information without refreshing the page. Here we will.
Advertisements

Support.ebsco.com EBSCOadmin Branding Tutorial. Welcome to the EBSCOadmin Skinning and Branding tutorial, where you will learn how to customize EBSCOhost.
Microsoft Expression Web-Illustrated Unit J: Creating Forms.
KompoZer. This is what KompoZer will look like with a blank document open. As you can see, there are a lot of icons for beginning users. But don't be.
Chapter 3 – Designing your web pages Dr. Stephanos Mavromoustakos.
11 Getting Started with ASP.NET Beginning ASP.NET 4.0 in C# 2010 Chapters 5 and 6.
Microsoft Word 2010 Lesson 1: Introduction to Word.
Microsoft Office 2010 Access Chapter 1 Creating and Using a Database.
Creating Web Page Forms
1 Excel Lesson 3 Organizing the Worksheet Microsoft Office 2010 Introductory Pasewark & Pasewark.
Stored Procedures Dr. Ralph D. Westfall May, 2009.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
Microsoft Visual Basic 2005 CHAPTER 12 Cell Phone Applications and Web Services.
Microsoft Visual Basic 2012 CHAPTER TWELVE (ENRICHMENT CHAPTER) Windows Store Apps.
 Using Microsoft Expression Web you can: › Create Web pages and Web sites › Set what you site will look like as you design it › Add text, images, multimedia.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
Copyright © Texas Education Agency, All rights reserved. 1 Web Technologies Website Development with Dreamweaver.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
CIS 338: Creating ActiveX Controls Dr. Ralph D. Westfall March, 2003.
© Ms. Masihi.  The Dreamweaver Welcome Screen first opens when you start Dreamweaver.  This screen gives you quick access to previously opened files,
Programming with Microsoft Visual Basic 2012 Chapter 12: Web Applications.
Web Technologies Website Development Trade & Industrial Education
Connecting to USF Network for Web Site SSH Secure Shell is the FTP program you will use to download your http files onto the USF server. To get the SSH.
Microsoft Visual Basic 2008 CHAPTER 8 Using Procedures and Exception Handling.
Intro to C++. Getting Started with Microsoft Visual Studios Open Microsoft Visual Studios 2010 Click on file Click on New Project Choose Visual C++ on.
Using FrontPage Express. Slide 1 Standard toolbars and menus Time indicator: gives an approximation of download time of the page.
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
Website Development with Dreamweaver
CIS 205—Web Design & Development Dreamweaver Chapter 5 Using HTML Tables to Lay Out a Page.
Microsoft Visual Basic 2008 CHAPTER SEVEN Creating Web Applications.
CSCI 6962: Server-side Design and Programming Introduction to Active Server Pages.
1 Data Bound Controls II Chapter Objectives You will be able to Use a Data Source control to get data from a SQL database and make it available.
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
MIS 3200 – C# (C Sharp)
Microsoft Visual Basic 2005 CHAPTER 7 Creating Web Applications.
Office 2003 Advanced Concepts and Techniques M i c r o s o f t Access Project 5 Enhancing Forms with OLE Fields, Hyperlinks, and Subforms.
CIS 451: USING ASP.NET TO CREATE XML Dr. Ralph D. Westfall February, 2009.
CIS 338: Using Queries in Access as a RecordSource Dr. Ralph D. Westfall May, 2011.
Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2.
Creating Buttons – Lesson 51 Creating Buttons Lesson 5.
1 Chapter 12 – Web Applications 12.1 Programming for the Web, Part I 12.2 Programming for the Web, Part II 12.3 Using Databases in Web Programs.
Microsoft Visual Basic 2008 CHAPTER TWELVE Cell Phone Applications and Web Services.
ASP.NET The Clock Project. The ASP.NET Clock Project The ASP.NET Clock Project is the topic of Chapter 23. By completing the clock project, you will learn.
Sports Website Creation. In this project you will design and produce your own website.
Layers, Image Maps, and Navigation Bars
BlackBerry Applications using Microsoft Visual Studio and Database Handling.
Photoshop Image Slicing. Reasons to Image Slide To create links out of sliced images To optimise different areas. (flat areas of colour, such as logos,
Know your computer Make a Folder Copy from Word to Composer Format the Font Change the Alignment Format the Background Format the Colors Insert a Picture.
Chapter 27 Getting “Web-ified” (Web Applications) Clearly Visual Basic: Programming with Visual Basic nd Edition.
11 Getting Started with ASP.NET Beginning ASP.NET in C# and VB Chapters 1 and 2.
1111 Creating HTML Programatically Objectives You will be able to Invoke C# code on the server from an ASP.NET page. Write C# code to create HTML.
Microsoft Visual Basic 2012 CHAPTER FOUR Variables and Arithmetic Operations.
11 User Controls Beginning ASP.NET in C# and VB Chapter 8.
CIS 338: VB.NET Printing Dr. Ralph D. Westfall May, 2011.
XP New Perspectives on Macromedia Dreamweaver MX 2004 Tutorial 5 1 Adding Shared Site Elements.
Integrating Components and Dynamic Text Boxes with the Animated Map– Lesson 101 Integrating Components and Dynamic Text Boxes with the Animated Map Lesson.
111 State Management Beginning ASP.NET in C# and VB Chapter 4 Pages
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 11 Creating Web Applications and Writing Data to a Database.
MIS 3200 – C# (C Sharp)
Dreamweaver – Setting up a Site and Page Layouts
Stored Procedures Dr. Ralph D. Westfall May, 2011.
3.01 Apply Controls Associated With Visual Studio Form
Access Project 8 Using Visual Basic for Applications (VBA) and Creating Multi-Page Forms.
Using Procedures and Exception Handling
Variables and Arithmetic Operations
1. Open Visual Studio 2008.
DREAMWEAVER MX 2004 Chapter 3 Working with Tables
Programming with Microsoft Visual Basic 2008 Fourth Edition
Presentation transcript:

ASP.NET Web Application Professor Ralph Westfall May 2011

Create a Web Project Start Visual Studio 2008  Create: Project*>Visual Basic>Web>ASP.NET Web Application>name it Proj3Web>OK  Click Design tab at bottom left if screen not seen  Drag lower right corner of div container at top down/right to be around 700x575 on screen  Click on the Split tab at bottom left of designer window to see if this created a with a style with these dimensions under the tag  Add Strict="True" just before the closing %> on the top line of the code (the line that starts with Page )‏ * NOT Create: Web Site

Absolute Positioning for All With an ASP project in Visual Studio Tools>Options>click Show all settings checkbox on lower left corner>HTML Designer>CSS Styling>check Change positioning to absolute …>OK  see images of this and instructionsimages of this and instructions View>Ruler and Grid>Show Grid to show gridlines to help with placement of controls  View>Ruler and Grid>Snap to Grid (if like coordinates to be multiples of 5)

Add DropDownList Drag a DropDownList from Standard section of ToolBox onto designer screen (may be slow to show) and name it cboCountries to make work with code from previous Windows project  Make sure that it is still selected, verify with Format>Set Position that Absolute is checked  Use the identifier tab above it to drag it down so there is space for a Label above it new items 1 st go to upper left, so leave space there  Widen it to have room for long country names  Do not pull length down

Controls with DropDownList Drag a Label onto screen, drag it above the DropDownList, set Text to Country ‏ Drag a Button onto the screen, move it about 40% of the way down the page, set (Name) to btnCountry, set Text to Select  can change values in Source window if Properties window is working slowly If haven't done so already, save the Proj3Web project on the Desktop

And More Controls Add a ListBox to right of the DropDownList and name it lstGolds  Adjust size (doesn't have to be wide)  Put Label above it (set Text to Golds), and Button below named btnGolds and Text = Select Add a CheckBox to right of this ListBox  Change the (Name) to chkPop and Text to Big Pop  Drag another Button to screen, to right of other Button and below CheckBox and set (Name) to btnPop and Text to Select

Output ListBox / Clear Button Add a ListBox for outputs below the left Button and then drag bottom and side to be longer and wider to hold outputs  Name it lstOutputs put Labels above it (set Text to show names of output fields)‏  Could use one Label with multiple nbsp; for spacing but it makes your code look kludgy (separate labels are better) Add a Button with (Name) of btnClear and set Text to Clear

Test Layout Click green triangle at top to run code  Click OK to modify Web.config file for debugging  View layout in web browser and make adjustments to positions of controls as necessary  View>[Page] Source to see the HTML code created by the ASP code Modify layout based on browser appearance  Make sure that content can be seen without scrolling on an 1024x768 screen  Move items up so top of page not empty

Add Existing Files to Project If haven't already, download and unzip Olympics-SQL-DB.zip Olympics-SQL-DB.zip In the ASP you are creating: Project>Add Existing Item>select BizTier.vb and DataTierSS.vb files from above project subfolder (below.sln file location)>Add Double-click a Button in the ASP Design view  Note the Default.aspx.vb file that was created  Go back to Default.aspx and click the other Buttons to get subs for them too

Setting Up the Databases Copy the Olympics.mdf and Olympics_log.ldf database files from the Olympics-SQL-DB cis338 folder into the App_Data subfolder of the Proj3Web folder on Desktop Modify previous connection string code to be: con.ConnectionString = "server=(local)\SQLEXPRESS; AttachDbFilename=|DataDirectory|\Olympics. mdf; Integrated Security=True;"

Adapting User Interface Code Use Notepad to open the Windows frmUI.vb code file in the Olympics-SQL-DB project  Copy Private data declarations and paste them above the Subs in Default.aspx.vb code file Following pages show how to copy and modify code for individual Subs

Form Load Code Copy and paste code from Sub frmUI_Load into Sub Page_Load  first and last lines of Sub Page_Load should be: If Not IsPostBack Then ' [copied Windows Form code in between] End If Change ComboBox item loading line as follows:  cboCountries.Items.Add(item.ToString.Trim) '* Run code to verify it works, debug if doesn't

Add Clear Code Paste ClearSelections() Sub and its code  change first three lines to read: lstOutputs.SelectedIndex = -1 lstGolds.SelectedIndex = -1 cboCountries.SelectedIndex = -1 Paste btnClear_Click code into Default.aspx.vb  delete the following line: lstOutputs.Items.Clear()

Add Country Code Copy corresponding Windows form code from btnCountry into Default.aspx.vb  Put following in general declaration above Subs Private slctIndex As Integer  paste the following over the first two lines: slctIndex = cboCountries.SelectedIndex If slctIndex = -1 Then MsgBox("Please select a country")  and last line is: cboCountries.SelectedIndex = slctIndex

Country Code - 2 Replace following line: lstOutputs.DataSource = BizTier.GetData("country", selector, "=") With the following four lines: ClearSelections() alsData = BizTier.GetData("country", selector, "=") For Each item In alsData lstOutputs.Items.Add(Trim(item.ToString)) Next Test

Add Golds and Pop Code Copy btnGolds Windows form code into corresponding Default.aspx.vb Sub  Change Sub as shown in previous slides, but with “golds” and lstGolds rather than “country” and cboCountries control Copy btnPop Windows form code into corresponding Default.aspx.vb Sub  Change Sub as shown in previous slides to load alsData and outputs Test after each conversion

Finishing UI Conversion Run after each copy/paste and see how many errors in the files you can fix Use Response.Redirect(" URL]") for btnExit code action instead of Close or Exit Tips for converting Windows Form code  Use MsgBox() rather than MessageBox.Show()  Load outputs from an ArrayList through a For Each loop rather than assigning a DataSource Note that BizTier Module doesn't require any changes  In this case, formatting is handled in data tier

Spacing For HTML Alignment The code on the following page adds spacing between fields in the output ListBox on the HTML page  Uses HttpUtility.HtmlDecode function to force browser to show spacing  This code replaces the PadLeft and PadRight functions used to produce spacing in Windows projects

Spacing Function Private Function PadIt(ByVal itm As String, ByVal syz As Integer, ByVal side As String) As String Dim itmPad As Integer Dim padding As String = "" itmPad = syz - itm.Length - 1 For i As Integer = 0 To itmPad padding &= " " Next If side = "right" Then itm &= HttpUtility.HtmlDecode(padding) Else itm = HttpUtility.HtmlDecode(padding) & itm End If Return itm End Function

Spacing Text ASP code is converted to HTML before being sent to browser For DataTierSS module code:  Add Imports System.Web.HttpContext at top of file for web server to insert spaces in output  Add following code line to general declarations: Private aligner() As String = {"right", "left", "left", "left", "left"}  Modify code line in For Each loop to read: rowData += PadIt(Trim(dr(dc).ToString()), pads(i), aligner(i))

Help for Fixing Errors View the code in the unzipped Web- Olympics-SQL-DB.zip folder to see how the migration was handled in that fileWeb- Olympics-SQL-DB.zip  Use changes in that file as a model to get the web project code to run