Download presentation
Presentation is loading. Please wait.
1
Web Application with Dataase
CS 3870: Note06 Prog3 Web Application with Dataase
2
The Database UWPCS3870 SQL Server on Alpha User: MSCS
(not case sensitive) Password: MasterInCS (case sensitive) Working with PCs in the Lab
3
Page Shopping Property AutoPastBack of Textbox Must be True to fire Textchanged event (When focus leaves the textbox)
4
Textchanged Event of Textbox txtID
// Clear other textboxes string id = txtID.Text.Trim(); System.Data.DataRow row = SQLDataClass.tblProduct.Rows.Find(id); if (row == null) // not found { txtID.Focus() } else // found txtQuanity.Focus()
5
Textchanged Event of Textbox txtID
if (row == null) { Session["Prog3_ID"] = ""; txtID.Focus(); } else txtName.Text = row[1].ToString(); txtPrice.Text = string.Format("{0:C}", row[2]); Session["Prog3_Price"] = row[2].ToString(); Session["Prog3_ID"] = id; txtQuantity.Focus();
6
Not Working!
7
AutoPostBack Control property Button Textbox Others Default: True
Default: False Others Should check
8
Textchanged Event of txtQuantity
lblQuantityError.Text = ""; int quantity = 0; if (!int.TryParse(txtQuantity.Text, out quantity) || quantity < 0) { lblQuantityError.Text = "Quanity must be a non-negative integer!"; return; } if ((string)Session["Prog3_ID"] == "") // clear textboxes txtID.Focus(); else // get price // calculate // Display result
9
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
10
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.
11
Grading If you make the same mistakes as in Prog2, the lost points will be doubled! For example, you will lose 2 points if your Prog3 rejects 0 for quantity.
12
Programming Rules Comment Block
For code files only Including Global.asax and SQLDataClass Not for *.aspx or .master files
13
Programming Rules Your Web pages should be the same as the sample pages.
14
Test 1 50 points Tuesday (week 5), October 2 Lab 206 2:00 – 4:00
Based on Prog3
15
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.
what is a reverse mortgage pros and cons