2022 ChapterThree
2022 ChapterThree
2022 ChapterThree
GOLLIS UNIVERSITY
Faculty of ICT…
…
GOLLIS UNIVERSITY,
GOLLIS UNIVERSITY,
CHAPTER THREE
CONTENTS
Console Application
GUI Application
Website Application
2. Toolbox window:
This window will display Controls
3. Properties window:
This window will display required control
properties
Web Form:
Webform is a template provided by visual studio to create ASP.NET webpages
Webform template will provide 3 views
1. Design View
this view allows developer to arrange controls
2. Source View
this view allows developer to place markup
content(tags) into the webpage this will display
markup content automatically generated by visual studio
3. Code View(cs file)
this view allows developer to place logic part
code into the webpage this will be provided
only for code file techniques
Creating Website Using VS
Inline Coding
Code behind
.aspx page
{
designer Code
Business Logic
}
CodeBihind.aspx
{
-design Code
}
CodeBehind.aspx.cs
{
-business logic
}
GOLLIS UNIVERSITY,
Creating ASP.NET Webpage Into Website
Id –lbldemo
Backgound----
Font,Size – X-Large
Placing logic part code into webpage – double click
on default.aspx webform window
Controls
12
Properties
Is an attribute of a control which mainly has it’s impact on the look of
the control.
BackColor, ForeColor, BorderColor,Font
Methods
A Method is an action that has to be performed.
Focus()
Events
An event is time period which tells when an action has to be performed.
Click, TextChanged, CheckedChanged
GOLLIS UNIVERSITY,
Web Forms Controls In ASP.NET(I)
13
GOLLIS UNIVERSITY,
14
Label Control
TextBox control
Button control
Literal control
PlaceHolder control
HiddenField control
FileUpload control
Image control
ImageButton control
ImageMap control
GOLLIS UNIVERSITY,
1.) Label Control:-
16
GOLLIS UNIVERSITY,
17
GOLLIS UNIVERSITY,
Step :2 Now Double Click on Click Button and Write the
following codes which is shown below:
18
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
}
protected void Button1_Click(object sender, EventArgs e)
{
Label2.Text = "You can easily display any information inside it";
}
}
GOLLIS UNIVERSITY,
Step :3 Now Run The Program(Press F5) and Press the Click
Button.
19
GOLLIS UNIVERSITY,
2.) TextBox Control:-
20
The TextBox control is used to input the Data(text).Any end user can easily enter the text in this
control.
Properties of TextBox Control:-
There are some important properties of TextBox controls.
Text:-It is used to sets the text in TextBox Control.
TextMode:- It is used to sets the mode of the TextBox Control as Single Mode,Multiline or
Password.
Rows:-It is used to sets the number of rows display in a TextBox(Multiline).
MaxLength:->It is used to sets the maximum number of character alloweded in a TextBox control.
ReadOnly:-It is used to read the contents by the end used but can not change it.
AutoCompleteType:-It is used to sets a value that indicates the Auto Complete behavior of the
TextBox control.
AutoPostBack:-It is used to handle the event when the TextBox control lose focus.
TextChange:-It is an event.It occurs when the end user change the text of the TextBox control.
GOLLIS UNIVERSITY,
3.) Button Control:-> The Button control is used to
create an Event and send request to the web server.
21
GOLLIS UNIVERSITY,
There are some steps to implement the TextBox and Button controls on the Web Form which is
given below:
Step :1 First Open Your Visual Studio-->File-->New-->Web Site-->Select ASP.NET Empty Web Site-->OK--
>Open Solution Explorer-->Right Click on Web Site-->Add New Item -->Select Web Form--> click Add--
>Now drag and drop TextBox,Label and Button control from Toolbox on the Web Form as Given below:
22
Step :2 Now Double Click on Button Control and Write the following which is given below:
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
}
protected void Button1_Click(object sender, EventArgs e)
{
String str = TextBox1.Text;
Label2.Text = str;
}
}
GOLLIS UNIVERSITY,
Properties of Literal Control:-
24
GOLLIS UNIVERSITY,
25
}
protected void Button1_Click(object sender, EventArgs e)
{
Literal1.Text = "Hello Asp.net Website I am Literal Control";
Label2.Text = "Hello Asp.net Website I am Label Control";
}
} GOLLIS UNIVERSITY,