SlideShare a Scribd company logo
BY-Teach4u.in
ASP.NET Controls
 ASP includes normal HTML elements
 Server-side controls are objects that provide
corresponding HTML output.
 You can set their properties, call methods and
program events on them
2
Server Controls
 Four types of server controls:
 HTML server controls: server-based equivalent for
standard HTML elements
 Web controls: more object properties and events + new
types of controls not in HTML
 Validation controls: check user inputs
 User controls: developer designed controls
 More controls in ASP.NET 2.0
3
HTML Server Controls
 An object interface for standard HTML elements
 Generate equivalent interface
 Retain their state
 Fire events
 Add the attribute “runat=serevr” and an id to the
HTML element start tag
4
HTML Server Controls Traditional HTML form
<html> <body>
<form method="post">
Enter Number of hours: <input type=text >
<input type=submit value="convert to seconds">
</form></body></html>
 ASP.NET HTML server controls
<HTML><BODY>
<form method="post" runat="server“ >
Enter Number of hours: <input type=text runat="server" id="hours">
<input type=submit value="convert to seconds" runat="server" id="convert">
</form></Body></HTML>
 Run server-control file and see the generated code
5
HTML Server Controls Automatically maintain state of controls in the page using
the hidden field which is compressed and encrypted code.
 Exists in System.Web.UI.HTMLControls
 Note: An .aspx page can only contain ONE <form
runat="server"> control!
 Two types of events: ServerClick, ServerChange
6
7
HTML Server Control Description
HtmlAnchor Controls an <a> HTML element
HtmlButton Controls a <button> HTML element
HtmlForm Controls a <form> HTML element
HtmlGeneric Controls other HTML element not specified by a specific HTML server
control, like <body>, <div>, <span>, etc.
HtmlImage Controls an <image> HTML element
HtmlInputButton Controls <input type="button">, <input type="submit">, and <input
type="reset"> HTML elements
HtmlInputCheckBox Controls an <input type="checkbox"> HTML element
HtmlInputFile Controls an <input type="file"> HTML element
HtmlInputHidden Controls an <input type="hidden"> HTML element
HtmlInputImage Controls an <input type="image"> HTML element
HtmlInputRadioButton Controls an <input type="radio"> HTML element
HtmlInputText Controls <input type="text"> and <input type="password"> HTML
elements
HtmlSelect Controls a <select> HTML element
HtmlTable Controls a <table> HTML element
HtmlTableCell Controls <td>and <th> HTML elements
HtmlTableRow Controls a <tr> HTML element
HtmlTextArea Controls a <textarea> HTML element
HTMLServer Control Properties
 Similar properties as HTML attributes:
 Input controls: value , type
 Img: src, width, height, ..
 HTML Container Controls: InnerText, InnerHtml
 All HTML controls have:
 Disabled, visible, TagName, Style, Page
8
Web Controls Provide rich user interface (mapped to more than
one HTML element)
 Provide more properties, events and methods
than HTML tags
 Detect browser type and adjust output
automatically
 Server controls automatically maintain any
client-entered values between round trips to the
server. This control state is not stored on the
server (it is instead stored within an <input
type="hidden"> form field that is round-tripped
between requests).
9
10
Web Server Control Description
Button Displays a push button
CheckBox Displays a check box
CheckBoxList Creates a multi-selection check box group
DropDownList Creates a drop-down list
HyperLink Creates a hyperlink
Image Displays an image
ImageButton Displays a clickable image
Label Displays static content which is programmable (span)
LinkButton Creates a hyperlink button
ListBox Creates a single- or multi-selection drop-down list
Panel Provides a container for other controls
RadioButton Creates a radio button
RadioButtonList Creates a group of radio buttons
Table Creates a table
TableCell Creates a table cell
TableRow Creates a table row
TextBox Creates a text box
Web Controls
 Tags start with prefix “asp:” then class name
 Attribute runat=server
 ASP.NET add “name” attribute to controls to track
them.
 Object properties are mapped to attributes
<asp:TextBox id=“T1” runat=“server”> </asp:TextBox>
<input type=text name=“T1” id=“T1” />
 Defined in System.Web.UI.WebControls
11
Web Controls All web controls have:
 BackColor, BorderColor and ForeColor
 BorderWidth, BorderStyle
 Font
 Height, Width
 TabIndex, AccessKey
 Enabled, visible, EnableViewState
 TextBox control properties:
 TextMode: SingleeLine, MultipleLine, Password
 MaxLength: maximum number of characters accepted
 Columns: width of the control
 Rows: display height of the control
12
Web Controls
 Button / label:
 text
 CheckBox / RadioButton :
 Text: (label next to the control)
 TextAlign: text alignment relative to control
 Checked
 Panel: Group a number of controls
 BackImageUrl
13
Web Controls
 Table:
 Properties: BackImageUrl, CellPadding, Cellspacing,
GridLines
 Rows a collection of TableRow objects
 TableRow
 Cells: a collection of TableCell objects
 TableCell
 ColumnSpan/RowSpan
 HorizontalAlign / VerticalAlign
 text
14
List Controls ListBox, DropDownList, CheckBoxList,
RadioButtonList
 Items: Collection of “ListItem” objects, which has:
 text : Displayed word
 value : hidden value in HTML code
 Selected: boolean
 Properties: SelectedIndex, SelectedItem
 Multiple selection for ListBox, set “SelectionMode” property
 RadioButtonList/ CheckBoxList properties:
 RepeatColumns, RepeatDirection, RepeateLayout, TextAlign
15
Web Control Events
 Events types: Click, TextChange, CheckChanged,
SelectedIndexChanged
 Change events have their autoPostBack property false
by default.
 ASP.NET adds a Java Script code that handles the
postback to the server when a server side control event
has occurred
 Two hidden fields (id of triggered control, and
additional information)
16
Page Lifecycle
 When the user changes a control that has
autopostback set to true:
1. Java script is invoked and the page is resubmitted
2. ASP.NET recreates page object from .aspx file
3. ASP.NET retrieves state information from hidden fields
and updates controls
4. Execute Page_load event handler
5. Execute appropriate event handlers
6. Execute page_unload event handler and render page
7. Send page to client
17
Page Processing Steps
18
Client
ASP.NET creates page objects
from aspx code
Web page request
ASP.NET runs Page.load
event handler
Final page is rendered
HTML output returned
Page postback
ASP.NET creates page objects
from aspx code
ASP.NET runs Page.load
event handler
Final page is rendered
ASP.Net runs any other
Triggered event handler
HTML output returned

More Related Content

What's hot

JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
Jsp ppt
Jsp pptJsp ppt
Jsp ppt
Vikas Jagtap
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
Monika Mishra
 
Master page in Asp.net
Master page in Asp.netMaster page in Asp.net
Master page in Asp.net
RupinderjitKaur9
 
Collection Framework in java
Collection Framework in javaCollection Framework in java
Collection Framework in java
CPD INDIA
 
Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
Kasun Madusanke
 
ASP.NET Lecture 1
ASP.NET Lecture 1ASP.NET Lecture 1
ASP.NET Lecture 1
Julie Iskander
 
Threads in JAVA
Threads in JAVAThreads in JAVA
Introduction to ajax
Introduction  to  ajaxIntroduction  to  ajax
Introduction to ajax
Pihu Goel
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
Arulmurugan Rajaraman
 
Java swing
Java swingJava swing
Java swing
Apurbo Datta
 
Databind in asp.net
Databind in asp.netDatabind in asp.net
Databind in asp.net
Sireesh K
 
Dom(document object model)
Dom(document object model)Dom(document object model)
Dom(document object model)
Partnered Health
 
Specificity and CSS Selectors
Specificity and CSS SelectorsSpecificity and CSS Selectors
Specificity and CSS Selectors
palomateach
 
HTTP Request and Response Structure
HTTP Request and Response StructureHTTP Request and Response Structure
HTTP Request and Response Structure
BhagyashreeGajera1
 
Php string function
Php string function Php string function
Php string function
Ravi Bhadauria
 
Bootstrap
BootstrapBootstrap
Bootstrap
Jadson Santos
 

What's hot (20)

JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
 
Jsp ppt
Jsp pptJsp ppt
Jsp ppt
 
Js ppt
Js pptJs ppt
Js ppt
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
 
Master page in Asp.net
Master page in Asp.netMaster page in Asp.net
Master page in Asp.net
 
Collection Framework in java
Collection Framework in javaCollection Framework in java
Collection Framework in java
 
Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
 
php
phpphp
php
 
ASP.NET Lecture 1
ASP.NET Lecture 1ASP.NET Lecture 1
ASP.NET Lecture 1
 
Threads in JAVA
Threads in JAVAThreads in JAVA
Threads in JAVA
 
ASP.NET Web form
ASP.NET Web formASP.NET Web form
ASP.NET Web form
 
Introduction to ajax
Introduction  to  ajaxIntroduction  to  ajax
Introduction to ajax
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
 
Java swing
Java swingJava swing
Java swing
 
Databind in asp.net
Databind in asp.netDatabind in asp.net
Databind in asp.net
 
Dom(document object model)
Dom(document object model)Dom(document object model)
Dom(document object model)
 
Specificity and CSS Selectors
Specificity and CSS SelectorsSpecificity and CSS Selectors
Specificity and CSS Selectors
 
HTTP Request and Response Structure
HTTP Request and Response StructureHTTP Request and Response Structure
HTTP Request and Response Structure
 
Php string function
Php string function Php string function
Php string function
 
Bootstrap
BootstrapBootstrap
Bootstrap
 

Viewers also liked

validation
validationvalidation
validation
teach4uin
 
Testing C# and ASP.net using Ruby
Testing C# and ASP.net using RubyTesting C# and ASP.net using Ruby
Testing C# and ASP.net using Ruby
Ben Hall
 
L18 applets
L18 appletsL18 applets
L18 applets
teach4uin
 
Java Programming- Introduction to Java Applet Programs
Java Programming- Introduction to Java Applet ProgramsJava Programming- Introduction to Java Applet Programs
Java Programming- Introduction to Java Applet Programs
Trinity Dwarka
 
Identifying the Inquiry and Stating the Problem
Identifying the Inquiry and Stating the ProblemIdentifying the Inquiry and Stating the Problem
Identifying the Inquiry and Stating the Problem
DAPHNIE MONTEVERDE
 
6.applet programming in java
6.applet programming in java6.applet programming in java
6.applet programming in javaDeepak Sharma
 
Intro To Asp Net And Web Forms
Intro To Asp Net And Web FormsIntro To Asp Net And Web Forms
Intro To Asp Net And Web Forms
SAMIR BHOGAYTA
 
Introduction to ASP.NET
Introduction to ASP.NETIntroduction to ASP.NET
Introduction to ASP.NET
Peter Gfader
 
Developing an ASP.NET Web Application
Developing an ASP.NET Web ApplicationDeveloping an ASP.NET Web Application
Developing an ASP.NET Web Application
Rishi Kothari
 

Viewers also liked (11)

validation
validationvalidation
validation
 
Testing C# and ASP.net using Ruby
Testing C# and ASP.net using RubyTesting C# and ASP.net using Ruby
Testing C# and ASP.net using Ruby
 
L18 applets
L18 appletsL18 applets
L18 applets
 
Java Programming- Introduction to Java Applet Programs
Java Programming- Introduction to Java Applet ProgramsJava Programming- Introduction to Java Applet Programs
Java Programming- Introduction to Java Applet Programs
 
Identifying the Inquiry and Stating the Problem
Identifying the Inquiry and Stating the ProblemIdentifying the Inquiry and Stating the Problem
Identifying the Inquiry and Stating the Problem
 
6.applet programming in java
6.applet programming in java6.applet programming in java
6.applet programming in java
 
Intro To Asp Net And Web Forms
Intro To Asp Net And Web FormsIntro To Asp Net And Web Forms
Intro To Asp Net And Web Forms
 
Note d'intention
Note d'intentionNote d'intention
Note d'intention
 
Introduction to ASP.NET
Introduction to ASP.NETIntroduction to ASP.NET
Introduction to ASP.NET
 
27 applet programming
27  applet programming27  applet programming
27 applet programming
 
Developing an ASP.NET Web Application
Developing an ASP.NET Web ApplicationDeveloping an ASP.NET Web Application
Developing an ASP.NET Web Application
 

Similar to Controls

ASP.NET 03 - Working With Web Server Controls
ASP.NET 03 - Working With Web Server ControlsASP.NET 03 - Working With Web Server Controls
ASP.NET 03 - Working With Web Server Controls
Randy Connolly
 
Html forms
Html formsHtml forms
Html forms
eShikshak
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
Nisa Soomro
 
Html5ppt
Html5pptHtml5ppt
Html5pptrecroup
 
Session iii(server controls)
Session iii(server controls)Session iii(server controls)
Session iii(server controls)
Shrijan Tiwari
 
Html Form Controls
Html Form ControlsHtml Form Controls
HTML-Forms
HTML-FormsHTML-Forms
HTML-Forms
Ahmed Saihood
 
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...SharePoint Saturday NY
 
ASP.NET Session 9
ASP.NET Session 9ASP.NET Session 9
ASP.NET Session 9Sisir Ghosh
 
SynapseIndia creating asp controls programatically development
SynapseIndia creating asp controls programatically developmentSynapseIndia creating asp controls programatically development
SynapseIndia creating asp controls programatically development
Synapseindiappsdevelopment
 
Html Guide
Html GuideHtml Guide
Html Guide
Jspider - Noida
 
Web forms and html lecture Number 4
Web forms and html lecture Number 4Web forms and html lecture Number 4
Web forms and html lecture Number 4
Mudasir Syed
 

Similar to Controls (20)

ASP.NET 03 - Working With Web Server Controls
ASP.NET 03 - Working With Web Server ControlsASP.NET 03 - Working With Web Server Controls
ASP.NET 03 - Working With Web Server Controls
 
Ch3 server controls
Ch3 server controlsCh3 server controls
Ch3 server controls
 
Controls in asp.net
Controls in asp.netControls in asp.net
Controls in asp.net
 
Html forms
Html formsHtml forms
Html forms
 
Chapter 6
Chapter 6Chapter 6
Chapter 6
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
Html forms
Html formsHtml forms
Html forms
 
Visual studio 2008 asp net
Visual studio 2008 asp netVisual studio 2008 asp net
Visual studio 2008 asp net
 
Html5ppt
Html5pptHtml5ppt
Html5ppt
 
Session iii(server controls)
Session iii(server controls)Session iii(server controls)
Session iii(server controls)
 
Html Form Controls
Html Form ControlsHtml Form Controls
Html Form Controls
 
HTML-Forms
HTML-FormsHTML-Forms
HTML-Forms
 
Chapter09
Chapter09Chapter09
Chapter09
 
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
 
ASP.NET Session 9
ASP.NET Session 9ASP.NET Session 9
ASP.NET Session 9
 
SynapseIndia creating asp controls programatically development
SynapseIndia creating asp controls programatically developmentSynapseIndia creating asp controls programatically development
SynapseIndia creating asp controls programatically development
 
Html Guide
Html GuideHtml Guide
Html Guide
 
WPF Controls
WPF ControlsWPF Controls
WPF Controls
 
Web(chap2)
Web(chap2)Web(chap2)
Web(chap2)
 
Web forms and html lecture Number 4
Web forms and html lecture Number 4Web forms and html lecture Number 4
Web forms and html lecture Number 4
 

More from teach4uin

validation
validationvalidation
validation
teach4uin
 
Master pages
Master pagesMaster pages
Master pages
teach4uin
 
.Net framework
.Net framework.Net framework
.Net framework
teach4uin
 
Scripting languages
Scripting languagesScripting languages
Scripting languages
teach4uin
 
Css1
Css1Css1
Css1
teach4uin
 
Code model
Code modelCode model
Code model
teach4uin
 
Asp db
Asp dbAsp db
Asp db
teach4uin
 
State management
State managementState management
State management
teach4uin
 
security configuration
security configurationsecurity configuration
security configuration
teach4uin
 
static dynamic html tags
 static dynamic html tags static dynamic html tags
static dynamic html tags
teach4uin
 
static dynamic html tags
static dynamic html tagsstatic dynamic html tags
static dynamic html tags
teach4uin
 
New microsoft office power point presentation
New microsoft office power point presentationNew microsoft office power point presentation
New microsoft office power point presentation
teach4uin
 
.Net overview
.Net overview.Net overview
.Net overview
teach4uin
 
Stdlib functions lesson
Stdlib functions lessonStdlib functions lesson
Stdlib functions lesson
teach4uin
 
enums
enumsenums
enums
teach4uin
 
memory
memorymemory
memory
teach4uin
 
array
arrayarray
array
teach4uin
 
storage clas
storage classtorage clas
storage clas
teach4uin
 
Cprogrammingprogramcontrols
CprogrammingprogramcontrolsCprogrammingprogramcontrols
Cprogrammingprogramcontrols
teach4uin
 
Cprogrammingoperator
CprogrammingoperatorCprogrammingoperator
Cprogrammingoperator
teach4uin
 

More from teach4uin (20)

validation
validationvalidation
validation
 
Master pages
Master pagesMaster pages
Master pages
 
.Net framework
.Net framework.Net framework
.Net framework
 
Scripting languages
Scripting languagesScripting languages
Scripting languages
 
Css1
Css1Css1
Css1
 
Code model
Code modelCode model
Code model
 
Asp db
Asp dbAsp db
Asp db
 
State management
State managementState management
State management
 
security configuration
security configurationsecurity configuration
security configuration
 
static dynamic html tags
 static dynamic html tags static dynamic html tags
static dynamic html tags
 
static dynamic html tags
static dynamic html tagsstatic dynamic html tags
static dynamic html tags
 
New microsoft office power point presentation
New microsoft office power point presentationNew microsoft office power point presentation
New microsoft office power point presentation
 
.Net overview
.Net overview.Net overview
.Net overview
 
Stdlib functions lesson
Stdlib functions lessonStdlib functions lesson
Stdlib functions lesson
 
enums
enumsenums
enums
 
memory
memorymemory
memory
 
array
arrayarray
array
 
storage clas
storage classtorage clas
storage clas
 
Cprogrammingprogramcontrols
CprogrammingprogramcontrolsCprogrammingprogramcontrols
Cprogrammingprogramcontrols
 
Cprogrammingoperator
CprogrammingoperatorCprogrammingoperator
Cprogrammingoperator
 

Recently uploaded

The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 

Recently uploaded (20)

The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 

Controls

  • 2. ASP.NET Controls  ASP includes normal HTML elements  Server-side controls are objects that provide corresponding HTML output.  You can set their properties, call methods and program events on them 2
  • 3. Server Controls  Four types of server controls:  HTML server controls: server-based equivalent for standard HTML elements  Web controls: more object properties and events + new types of controls not in HTML  Validation controls: check user inputs  User controls: developer designed controls  More controls in ASP.NET 2.0 3
  • 4. HTML Server Controls  An object interface for standard HTML elements  Generate equivalent interface  Retain their state  Fire events  Add the attribute “runat=serevr” and an id to the HTML element start tag 4
  • 5. HTML Server Controls Traditional HTML form <html> <body> <form method="post"> Enter Number of hours: <input type=text > <input type=submit value="convert to seconds"> </form></body></html>  ASP.NET HTML server controls <HTML><BODY> <form method="post" runat="server“ > Enter Number of hours: <input type=text runat="server" id="hours"> <input type=submit value="convert to seconds" runat="server" id="convert"> </form></Body></HTML>  Run server-control file and see the generated code 5
  • 6. HTML Server Controls Automatically maintain state of controls in the page using the hidden field which is compressed and encrypted code.  Exists in System.Web.UI.HTMLControls  Note: An .aspx page can only contain ONE <form runat="server"> control!  Two types of events: ServerClick, ServerChange 6
  • 7. 7 HTML Server Control Description HtmlAnchor Controls an <a> HTML element HtmlButton Controls a <button> HTML element HtmlForm Controls a <form> HTML element HtmlGeneric Controls other HTML element not specified by a specific HTML server control, like <body>, <div>, <span>, etc. HtmlImage Controls an <image> HTML element HtmlInputButton Controls <input type="button">, <input type="submit">, and <input type="reset"> HTML elements HtmlInputCheckBox Controls an <input type="checkbox"> HTML element HtmlInputFile Controls an <input type="file"> HTML element HtmlInputHidden Controls an <input type="hidden"> HTML element HtmlInputImage Controls an <input type="image"> HTML element HtmlInputRadioButton Controls an <input type="radio"> HTML element HtmlInputText Controls <input type="text"> and <input type="password"> HTML elements HtmlSelect Controls a <select> HTML element HtmlTable Controls a <table> HTML element HtmlTableCell Controls <td>and <th> HTML elements HtmlTableRow Controls a <tr> HTML element HtmlTextArea Controls a <textarea> HTML element
  • 8. HTMLServer Control Properties  Similar properties as HTML attributes:  Input controls: value , type  Img: src, width, height, ..  HTML Container Controls: InnerText, InnerHtml  All HTML controls have:  Disabled, visible, TagName, Style, Page 8
  • 9. Web Controls Provide rich user interface (mapped to more than one HTML element)  Provide more properties, events and methods than HTML tags  Detect browser type and adjust output automatically  Server controls automatically maintain any client-entered values between round trips to the server. This control state is not stored on the server (it is instead stored within an <input type="hidden"> form field that is round-tripped between requests). 9
  • 10. 10 Web Server Control Description Button Displays a push button CheckBox Displays a check box CheckBoxList Creates a multi-selection check box group DropDownList Creates a drop-down list HyperLink Creates a hyperlink Image Displays an image ImageButton Displays a clickable image Label Displays static content which is programmable (span) LinkButton Creates a hyperlink button ListBox Creates a single- or multi-selection drop-down list Panel Provides a container for other controls RadioButton Creates a radio button RadioButtonList Creates a group of radio buttons Table Creates a table TableCell Creates a table cell TableRow Creates a table row TextBox Creates a text box
  • 11. Web Controls  Tags start with prefix “asp:” then class name  Attribute runat=server  ASP.NET add “name” attribute to controls to track them.  Object properties are mapped to attributes <asp:TextBox id=“T1” runat=“server”> </asp:TextBox> <input type=text name=“T1” id=“T1” />  Defined in System.Web.UI.WebControls 11
  • 12. Web Controls All web controls have:  BackColor, BorderColor and ForeColor  BorderWidth, BorderStyle  Font  Height, Width  TabIndex, AccessKey  Enabled, visible, EnableViewState  TextBox control properties:  TextMode: SingleeLine, MultipleLine, Password  MaxLength: maximum number of characters accepted  Columns: width of the control  Rows: display height of the control 12
  • 13. Web Controls  Button / label:  text  CheckBox / RadioButton :  Text: (label next to the control)  TextAlign: text alignment relative to control  Checked  Panel: Group a number of controls  BackImageUrl 13
  • 14. Web Controls  Table:  Properties: BackImageUrl, CellPadding, Cellspacing, GridLines  Rows a collection of TableRow objects  TableRow  Cells: a collection of TableCell objects  TableCell  ColumnSpan/RowSpan  HorizontalAlign / VerticalAlign  text 14
  • 15. List Controls ListBox, DropDownList, CheckBoxList, RadioButtonList  Items: Collection of “ListItem” objects, which has:  text : Displayed word  value : hidden value in HTML code  Selected: boolean  Properties: SelectedIndex, SelectedItem  Multiple selection for ListBox, set “SelectionMode” property  RadioButtonList/ CheckBoxList properties:  RepeatColumns, RepeatDirection, RepeateLayout, TextAlign 15
  • 16. Web Control Events  Events types: Click, TextChange, CheckChanged, SelectedIndexChanged  Change events have their autoPostBack property false by default.  ASP.NET adds a Java Script code that handles the postback to the server when a server side control event has occurred  Two hidden fields (id of triggered control, and additional information) 16
  • 17. Page Lifecycle  When the user changes a control that has autopostback set to true: 1. Java script is invoked and the page is resubmitted 2. ASP.NET recreates page object from .aspx file 3. ASP.NET retrieves state information from hidden fields and updates controls 4. Execute Page_load event handler 5. Execute appropriate event handlers 6. Execute page_unload event handler and render page 7. Send page to client 17
  • 18. Page Processing Steps 18 Client ASP.NET creates page objects from aspx code Web page request ASP.NET runs Page.load event handler Final page is rendered HTML output returned Page postback ASP.NET creates page objects from aspx code ASP.NET runs Page.load event handler Final page is rendered ASP.Net runs any other Triggered event handler HTML output returned