Content

You cannot learn programming by only looking at examples. Please refer to the recommended text book (Murach's ASP.NET 4.5 Web Programming with C# 2012) for detailed explanations.


Basic asp.net C# examples:

aps.net etc file / title Txt file / link Description Video
step 1. preparation, basic html review, setup IIS, install visual studio 2013 express
Preparation   - Show File Extensions in Windows 8/8.1 video 00_001
    - install notepad++ video 00_002
    - Create Screen Captures, Save As PDF Files video 00_003
html Review
html/css page

JavaScript page
- First HTML 5 File - html 5, notepad++, W3C Markup Validator video html_ex001_basic
    - Linking HTML & CSS Files video html_ex003_selector
Setup environment   - install IIS on Windows 8, enable static content, root directory video 04_001
iis setup windows 8
    - port 80 conflict Apache
- change IISAdmin, W3SVC (World Wide Web Publishing Service), SQL Server, Services to Manual
video 04_002
iis setup windows 8
    - create alias (virtual directory)
- IIS_IUSERS - enable static content

video 04_003
iis setup windows 8
    - enable directory browsing
- enable asp.net
- install Visual Studio 2013 Express
video 04_004
iis setup windows 8
video 04_005
visual studio 2013 install
Step 2. basic asp.net C# examples - one page web application (web site)
eg001
- Default.aspx
- Default.aspx.cs
- Style.css
- Web.config
- Web.Debug.config
  - visual studio 2013 express
- file > new web site
- asp.net empty web site (C#)
- right-click on project > add new item > web form
- file > close solution
- file > open website (file system), choose IIS Express or IIS local
- tools > options > all languages (word wrap, line numbers)

- create form elements
- add validators
video 04_006

video 04_007

video 04_008

video 04_009

video 04_010

video 04_011

video 04_012

video 04_013

video 04_014

video 04_015
       
 

 

MS SQL and asp.net C# example (eg002, asp.net C# textbook ch. 4):

Connect to Microsoft SQL database using asp.net C#.

asp.net etc file Txt file / link Description Video
step 0 install MS SQL database (MS SQL Server 2014 Express)
  Download MS SQL Server 2014 Express choose... SQL Server 2014 Express with Tools for download (includes management studio)

may need to download other MS service packs to solve installation problems

change sql adminstrator (sa) password: rootpass
video 04_016 sql server 2014 express installation

video 04_017

video 04_018
    access database through management studio  
step 1 create database
kungfu_panda_shop.sql kungfu_panda_shop.txt create database using .sql file video 04_019 load sql file
    - management studio > file > open > file
- right click > refresh
- Security > right click > new login (web_user, mypass)
- Security > Logins > web_user > right click > properties > User Mapping > choose database > db_datareader > db_datawriter
video 04_020 eg002

video 04_021
step 2 create aspx pages to link to database
Order.aspx
Order.aspx.cs

App_Code/Product.cs
(product class used in Order.aspx.cs)

  - if running from IIS, need to convert virtual directory to application (right click > convert to application > application pool > .net v4.5

- create connection to database
- SQL Server Configuration Manager > SQL Server Network Configuration > Protocols for SQLEXPRESS
TCP/IP > enable -------- extra: TCP/IP > properties (check port number)
- services > SQL Server Agent (manual, start) - optional
- services > SQL Server Browser (manual, start) - optional
- VS > Toolbox > Data > SqlDataSource
- VS > Toolbox > Standard > DropDownList
- add "AutoPostBack="True" for DropDownList

video 04_022

video 04_023

video 04_024

video 04_025

video 04_026

video 04_027

web.config

web.Debug.config

add the text on right for validation to work <appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None"/>
</appSettings>
video 04_028

video 04_029
App_Code/CartItem.cs
App_Code/CartItmeList.cs
  now create the two cs files containing two classes
the classes are used in Order.aspx.cs
video 04_030
App_Data/*.mdf local mdf file is not used here, using SQL Server 2014 Express   video 04_031
Images/Products/ download images    
Styles/style.css download Style.css    
step 3 dealing with session
Cart.aspx
Cart.aspx.cs
  something extra