Sei sulla pagina 1di 22

BIE 33103

DOT NET PROGRAMMING

SEM 1I 2016/2017

GUI PROGRAMMING
Introduction

.NET is language independent


Supported language C# and VB.NET
We will use C# in this class
What is the difference between ASP.NET and Classic
ASP/PHP
- ASP.NET is compiled, classic ASP/PHP is
interpreted.
- PHP can be hosted in linux & windows,
ASP.NET can only be hosted in windows

We will use Visual Studio Express 2012 its free,


download & install
Download & Install VS 2012 Express
Your First Website

1
Creating the Web Site

4 5
Adding new item

3 2

1) Right click
Adding Web Forms (aspx file)

1
2

4
Writing the first script
2) Add code

1) Double click
Running your first web apps
1

2
It works !

Your first ASP.NET


website
CodeBehind
A technique which allows separation of markup (HTML,
CSS etc) and code (C#,VB.NET etc)
Scripting block (using <% %>) is fine for a small and
simple example.
VS added file called Default.aspx.cs
First, remove the script code
Delete the scripting
block & save the file
Open the code file (*.aspx.cs)

1) Click to
expand

2) Double click
The object-oriented concept

namespace

Inherited class

Class
name

Inheritance symbol
method
Insert the code line

Insert code here,


save then
run(ctrl+F5)
And, it works !

Your first ASP.NET


website using
CodeBehind
Events
ASP.NET is event-driven web apps
Example of events: Page load, a click of a button
Adding controls

Add this code

Design view
Adding control event
A new
Double click method has
been added in
the
CodeBehind
file

An attribute has
been added
Adding code to the event

Add this code,


save and run
again
Test the control event

Click this button

Input text

The result
More events creating own method

Add event

Add control

Add method

Potrebbero piacerti anche