1 CS 3870/CS 5870: Lab4 Save with Invalid Price Keep Order After Updating.

Slides:



Advertisements
Similar presentations
Unit 02. ASP.NET Introduction HTML & Server controls Postbacks Page Lifecycle.
Advertisements

Introduction to Web Application Development with.Net and Web Service ISYS 350.
Introduction to ASP.Net ISYS 350. ASP.NET ASP.NET is a server-side technology for creating dynamic web pages. ASP.NET allows you to use a selection of.
Instructor: Adil Ibrahim Office: 212 Ullrich Phone: ibrahima 1.
Stored Procedures Dr. Ralph D. Westfall May, 2009.
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
CS 2340: Programming in VB Instructor: Dr. Qi Yang Office: 213 Ullrich Phone: YangQ 1.
Visual Basic 2008 Express Edition The IDE. Visual Basic 2008 Express The Start Page Recent Projects Open an existing project Create a New Project.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
CS 2340 Programming in VB.NET Instructor: Dr. Qi Yang Office: 213 Ullrich Phone: YangQ 1.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
1 Web-Enabled Decision Support Systems Introduction to ASP.NET Prof. Name Position (123) University Name.
M Dixon 1 Web-Application Development Workshop. M Dixon 2 Session Aims & Objectives Aims –to introduce the main concepts involved in creating web-applications.
CIS 338: Creating ActiveX Controls Dr. Ralph D. Westfall March, 2003.
ASP.NET Web Application Professor Ralph Westfall May 2011.
Copyright 2007, Information Builders. Slide 1 WebFOCUS Maintain – Enhancing Objects with JavaScript Mark Derwin Information Builders Information Builders.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
INSPIRING CREATIVE AND INNOVATIVE MINDS Module 4: Adding Code to a Microsoft ASP.NET Web Form Implementing Code-Behind Pages Adding Event Procedures to.
© Minder Chen, ASP.NET 2.0: Introduction - 1 ASP.NET 2.0 Minder Chen, Ph.D. Framework Base Class Library ADO.NET: Data & XML.
ASP.NET application. Roadmap ASP.NET file types Bin directory Application updates Simple application from start to finish using a virtual directory Behind.
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.
Internet Technologies and Web Application Web Services With ASP.NET Tutorial: Introduction to.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
1 CS 3870/CS 5870: Note 11 Authentication and Authorization Membership Provider.
CIS 451: USING ASP.NET TO CREATE XML Dr. Ralph D. Westfall February, 2009.
1 CS 3870/CS 5870 Note04 Session Variables and Post Back.
1 CS 3870/CS 5870: Note 13 Lab 6 Authentication and Authorization Roles Management.
Dynamic Dropdown Lists 1. Objectives You will be able to Use Dropdown Lists to solicit multiple choice user input in an ASPX web page. Populate a Dropdown.
1 CS 3870/CS 5870: Note 07 Lab 3 Lab 4 Test 1: Two Tables.
An Example of Windows Forms Applications Windows-based application –Win Forms Control structures (selection and repetition) Graphics Read integers from.
Applications Development
M Dixon 1 Web-Application Development Workshop. M Dixon 2 Session Aims & Objectives Aims –to introduce the main concepts involved in creating web-applications.
1 CS 3870/CS 5870: Note05 Prog3 Web Application with Database.
1 CS 3870/CS 5870: Note 19 SiteMap and AJAX Lab 8.
1 CS 3870/CS 5870: Note 20 Web Service. 2 What is Web Service? Providing functionality online to other applications, Web and Windows applications. The.
1 CS387/CS587: Note 08 Shopping Bag DataTable. 2 DataClass Public Shared Function NewShoppingBag() As Data.DataTable Dim bag As New Data.DataTable bag.Columns.Add("Product.
1 CS387/CS587: Note05 Lab 3. 2 Global.asax Must not be under any sub-folder Application_Start Application_End Application_Error Session_Start Session_End.
1 CS 3870/CS 5870: Note 12 Authentication and Authorization Membership Provider.
Created by Alia Al-Abdulkarim 2008 Visual Basic Vs. Java.
More PowerPoint. Re-using your slides You can re-use your slides in different presentation. Choose Insert, Slides from Files Browse to locate the presentation.
1 CS 3870/CS 5870: Note 16 Web User Controls. Prog 7 Copy Prog6 to Prog7 Modify all files for Prog7 Remove Web.config from sub-folders Make sure Prog7.
1 CS387/CS587: Note04 Lab 3. 2 Master Page All Web pages will be similar Should be created before other web pages Add New Items Controls on the Master.
1 CS 3870/CS 5870: Note 13 Web Service. 2 What is Web Service? Providing functionality online to other Web applications SOAP Simple Object Access Protocol.
1 CS 3870/CS 5870: Note 14. Prog5 Due 10 PM Wednesday, Oct 21 Authentication and Authorization 2.
1 CS 3870/CS 5870: Note07 Prog 4. Master Pages Creating a master page based on another master page MainMasterPage –For all Progs and Tests Prog4MasterPage.
1111 Creating ASPX Controls Programatically Objectives You will be able to Dynamically add controls to a page. Dynamically alter properties of controls.
1 CS 3870/CS 5870: Note 12 Membership Class. 2 Logging in User Programmatically If Membership.ValidateUser(txtUserName.Text, txtPassword.Text) Then FormsAuthetication.RedirectFromLoginPage(...)
11 User Controls Beginning ASP.NET in C# and VB Chapter 8.
1 CS 3870/CS 5870: Note 19 AJAX Prog8. Test 2 50 Points Thursday, Nov 12 2:00 PM – 4:00 PM Lab
111 State Management Beginning ASP.NET in C# and VB Chapter 4 Pages
Building CSS in Visual Studio Slide 2 Introduction Using the different HTML (and other) Visual Studio Editors CSS tools.
1. Prog3 Try and Catch Testing 2 Catching Database Errors Protected Sub DetailsView1_ItemDeleted( sender As Object, e As DetailsViewDeletedEventArgs)
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 11 Creating Web Applications and Writing Data to a Database.
ASP.NET Forms.
CS 3870/CS 5870 Web Service.
Web Application with Database
CS 3870/CS 5870 Web User Controls.
Session Variables and Post Back
Web Application with Dataase
CS 2340: Programming in VB Instructor: Dr. Qi Yang Office: 213 Ullrich
Web Development in Microsoft Visual Studio 2013
CS 3870/CS 5870 Web User Controls Events (II).
CS 3870 Prog5 Shopping Bag.
CS 3870 Web User Control Events.
Static and Dynamic Web Pages
Tonga Institute of Higher Education
CS 3870/CS 5870 Test 2 (50 points) Thursday
Web Application with Dataase
Presentation transcript:

1 CS 3870/CS 5870: Lab4 Save with Invalid Price Keep Order After Updating

2 Lab 5 Web User Controls Copy Folder Lab4 or Create New Folder Lab5?

3 Creating Web User Controls Add New Items File name *.ascx Add controls on the user controls Use Position Relative (default) Set control properties Add HTML tags, e.g.

4 ShoppingItem.ascx.vb Partial Class ShoppingItem Inherits System.Web.UI.UserControl ‘ Make it easy to use ‘ (or make set/get methods) Public theID, theName As String Public thePrice, theCost As Double Public theQuantity As Int32 End Class

5 Page (Control) Load Event Partial Class ShoppingItem Inherits System.Web.UI.UserControl Protected Sub Page_Load(...) Handles Me.Load txtID.Text = theID txtName.Text = theName txtPrice.Text = FormatCurrency(thePrice) txtQuantity.Text = quantity txtCost.Text = FormatCurrency(theCost) End Sub End Class

Page Checkout Without Master Page (Default2.aspx) 6

7 Loading User Controls at Design Time Build Web Site Design view of a web page (Default2aspx) Drag the ShoppingItem.ascx from the solution explorer to the page (Checkout.aspx) In the page load ShoppingItem1.theID = "P101" ShoppingItem1.thePrice = 120.5

8 Reference to User Controls ‘ A new line (page directive) was added to Checkout.aspx when dragging it to the page ‘ in Source View

9 Loading User Controls at Run Time Must have the reference on the page to use the control (Dragging or Copy/Paste)

10 Page Shopping.aspx You can still use DataTable as in Lab4 Dim c1 As ShoppingItem Dim bag As ArrayList Protected Sub Button1_Click(...) Handles btnAdd.Click If Session("myBag") Is Nothing Then bag = New ArrayList Else bag = Session("myBag") End If c1 = CType(LoadControl("ShoppingItem.ascx"), ShoppingItem.ascx) c1.theID = TextBox1.Text c1.theName = TextBox2.Text c1.price = TextBox3.Text bag.Add(c1) Session("myBag") = bag End Sub

11 Page Default2.aspx ‘ Declare c1, c2 As ShoppingItem & bag As ArrayList Protected Sub Page_Load(...) Handles Me.Load If Session("myBag") Is Nothing Then Exit Sub End If bag = Session("myBag") Dim myControl As Control = Page.FindControl("Form1") For x As Integer = 0 To bag.Count - 1 c1 = CType(LoadControl("ShoppingItem.ascx"), ShoppingItem) c2 = bag(x) c1.theID = c2.theID c1.theName = c2.theName c1.thePrice = c2.thePrice c1.theQuantity = c2. theQuantity c1. theCost = c2.theCost myControl.Controls.Add(c1) Next End Sub

12 Formatting ShoppingItem Same as other web pages Adding

13 Page Default2.aspx: Panel Add Panel1 Set position of both textbox1 and Panel1 to Absolute Adjust their positions Inside Default2.aspx.vb Dim myControl As Control = Page.FindControl("form1") myControl = Page.FindControl("Panel1") Dim total As Single = 0.0 For x As Integer = 0 to bag.Count total += c1._cost myControl.Controls.Add(c1) Next TextBox1.Text = FormatCurrency(total)

Checkout: Using Master Page Add Panel1 to the master page Set position to Absolute Adjust position 14

15 Checkout.aspx with Master Page ‘ Master: VB function to return the master page Dim myControl As Control = Master.FindControl(“form1”).FindControl(“Panel1”) Dim total As Single = 0.0 For x As Integer = 0 to bag.Count total += c1._cost myControl.Controls.Add(c1) Next TextBox1.Text = FormatCurrency(total)

16 Cannot Cast Move to another PC if you see the following Cannot cast ASP.ShoppingItem to ShoppingItem