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 10, enable static content, root directory video 09_001
iis setup windows 10
    - port 80 conflict Apache
- change IISAdmin, W3SVC (World Wide Web Publishing Service), Change Services to manual
video 09_002
iis setup windows 10
    - create alias (virtual directory)
- IIS_IUSERS - enable static content

video 09_003
iis setup windows 10
    - enable directory browsing
- enable asp.net
- install Visual Studio 2015 (installation takes a lot of time)
video 09_004
iis setup windows 10


video 09_005
visual studio 2015 install


video 09_005a
visual studio 2015 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 2015 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 09_006

video 09_007

video 09_008

video 09_008a

video 09_009

video 09_010

video 09_011

video 09_012

video 09_013

video 09_014

video 09_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... Try SQL Server 2014 Express for free

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

video 09_017

video 09_018
    access database through management studio  
step 1 create database
kungfu_panda_shop.sql kungfu_panda_shop.txt create database using .sql file video 08_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 09_020 eg002

video 09_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)

Lavasoft TCP Service may cause IIS to database connection issue

  - 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 09_022

video 09_023

video 09_024

video 09_025

video 09_026

video 09_027

web.config

web.Debug.config

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

video 09_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 09_030
App_Data/*.mdf local mdf file is not used here, using SQL Server 2014 Express    
Images/Products/ download images    
Styles/style.css download Style.css    
step 3 dealing with session
Cart.aspx
Cart.aspx.cs
  something extra