Web Application with Dataase CS 3870/CS 5870: Note06 Prog3 Web Application with Dataase
AutoPostBack Control property Button Textbox Others Default: True Default: False Others Should double check
Page Shopping Property AutoPastBack of Textbox Must be True to fire Textchanged event (When focus leaves the textbox)
Textchanged Event of Textbox txtID ‘ Clear other textboxes id = txtID.Text.Trim Dim row as Data.DataRow row = SQLDataClass.tblProducts.Rows.Find(id) If row Is Nothing Then ‘ not found . . . txtID.Focus() Else ‘ Found txtQuanity.Focus() End If
Textchanged Event of Textbox txtID If row Is Nothing Then ‘ not found Session(“Prog3_ID”) = “” txtID.Focus() Else ‘ Found txtName.Text = row(1) price = row(2) txtPrice.Text = FormatCurrency(price) Session("Prog3_Price") = price Session("Prog3_ID") = id txtQuanity.Focus() End If
Textchanged Event of txtQuantity If Session("Prog3_ID") = "" Then txtID.Focus() Exit Sub End If ‘ Otherwise, need to parse txtPrice or search database price = Session("Prog3_Price") subTotal = quanity * price tax = subTotal * 0.055 grandTotal = subTotal + tax ‘ Display result
DBNull ‘ Page Updating ‘ Procedure DisplayRow ‘ finding the row txtID.Text = row(0) txtName.Text = row(1) txtPrice.Text = FormatCurrency(row(2)) // Description is not required If TypeOf (row(3)) Is DBNull Then txtDescription.Text = "" Else txtDescription.Text = row(3) End If ManageButtons()
Validating Input txtID txtQuantity No need to do it Database will check it txtQuantity Validator No Validator Your choice Prog3 of CS3870 does not use Validator
Grading You will lose 15 points if page Default.aspx cannot access the database. You will lose 10 points if page Updating.aspx or page Shopping.aspx cannot work correctly with the database.
Grading You must follow the Programming Rules
Comment Block For code files only Including Global.asax and SQLDataClass Not for *.aspx or .master files
Programming Rules Your Web pages should be the same as the sample pages.
Prog3 Global.asax Web.config <customErrors mode="Off"/> <compilation debug=“true" targetFramework="4.5"> Price: reject 0 Quantity: accept 0
Test 1 50 points Tuesday (week 5), October 3 Lab 206 2:00 – 4:00 Based on Prog3
Test 1 Grading Cannot display records in GridView: -15 Cannot display individual records: -15 Formatting GridView: 5 points Placing controls: 5 points Checking input: 5 points Help: -5