SlideShare a Scribd company logo
2
Most read
3
Most read
11
Most read
Types of Server Controls
ASP.NET Web Server Controls
HTML Server Controls
Creating Server Controls Dynamically
 With ASP. Net, these are any controls that run in the
server space.
o Handled by ASP. Net runtime
o Must have runt=“server” attribute within the ASP. Net web form
o Always identified with the “ID” attribute (also mandatory with
ASP. Net web controls)
 Properties, events, etc. can all be handled by server-side
code
• Label
• Textbox
• Button
• Link
• Link Button
• Dropdown List
• List Box
• Checkbox
• Radio Button
• Image
• File Upload
• Panel
• <span />
• <input type=“text” />
• <input type=“submit” />
• <a href=[#|page] />
• <a href=[postback] />
• <select />
• <select [size=x] />
• <input type=“checkbox” />
• <input type=“radio” />
• <img />
• <input type=“file” />
• <div />
• Like the ASP. Net Page object
(System.Web.UI.Page), web controls maintain
the same event processing
– Init, PreRender, Load, etc
• If AutoPostBack is set on the control, the
event will be fired immediately (causes an
automatic postback), otherwise, the event will
fire upon next page postback
• Checkbox
– Check Changed()
• Button
– Click(), Command()
• Dropdown List
– Text Changed(), SelectedIndexChanged()
• System.Web.UI.HtmlControls
– Ex: HtmlButton, HtmlTable, HtmlInputText
• These are ASP. Net HTML server controls
– Rendered as:
– <button />, <table />, <input type=“text” />
• The HtmlControls collection allows the
programmer access to HTML elements (and their
properties, etc.) from server-side code
– Hence, page content (HTML elements) can also be
dynamically generated in the code behind or
classes
• All controls in this collection inherit from the
HtmlControl class
• HtmlAnchor
• HtmlButton
• HtmlInputButton
• HtmlInputHidden
• HtmlInputText
• HtmlImage
• HtmlSelect
• HtmlTable
• HtmlTextArea
• HtmlGenericControl
<a />
<button />
<input type=“button” />
<input type=“hidden” />
<input type=“text” />
<img />
<select />
<table />
<text area />
<span />, <body />, <h1 />,
<div />…
• Properties and Events can be managed efficiently in
the code behind
• Any server control can be referenced by its ID
property
Example:
txtTextBox.Text = “Hello!”;
• Code is written by the event handler that is
defined by the control
– <asp: Button On Click=“bttnGo_Click”... />
bttnGo_Click(object sender, …) { … }
• This is the key to maintaining clean, efficient
code for processing form data and UI
interaction
• It is good practice to prefix the name of
control ID to text that indicates its “Type”
o Textbox  txtName
o Checkbox  chkCorrect
o Dropdown List  ddlProductTypes
o Panel  pnlCustInfo
• This will make it easier when referring to
the controls at runtime in code
• Data
– GridView
– DataList
– SqlDataSource
– etc.
• Validation (server-side)
– RequiredFieldValidator
– RangeValidator
– RegularExpressionValidator
• Navigation
– SiteMapPath
– Menu
– TreeView
– etc.
• Login
– Login
– LoginView
– etc.
• Everything in VB/C# is an object, therefore
ASP. Net server controls are objects as well
• Controls can be dynamically created using
server side code (VB/C#)
Control Name Properties
 RequiredFieldValidator
 CompareValidator
 RangeValidator
 RegularExpressionValidator
 CustomValidator
 ValidationSummary
ControlToValidate, Display ,
ErrorMessage,ValidationGroup,
ControlToCompare,
MaximumValue,MinimumValue
Validation Expression
Text,ClientValidationFunction,
OnServerValidate
Header Text

More Related Content

PPT
ASP.NET Session 5
PDF
Visual studio 2008 asp net
PPT
ASP.NET Session 10
PPTX
Web design - Working with forms in HTML
PPT
Oracle Forms: Non input Items
PPTX
Academy PRO: HTML5 API Introduction
PPTX
HTML Forms
ASP.NET Session 5
Visual studio 2008 asp net
ASP.NET Session 10
Web design - Working with forms in HTML
Oracle Forms: Non input Items
Academy PRO: HTML5 API Introduction
HTML Forms

What's hot (6)

PPTX
Controls
PPTX
New Form Element in HTML5
PPT
ASP.NET 03 - Working With Web Server Controls
PPTX
Html form tag
KEY
HTML5 Form Validation
PDF
Html forms
Controls
New Form Element in HTML5
ASP.NET 03 - Working With Web Server Controls
Html form tag
HTML5 Form Validation
Html forms
Ad

Viewers also liked (19)

DOC
PDF
வெற்றி
PDF
ENOG 9 - RIPE vs RIPE NCC from the beginning to after the NTIA transition
PDF
வெற்றி
PPTX
Skuteczna komunikacja | w 6 krokach
PPTX
20150324 av vvc
PDF
See4 RIPE vs RIPE NCC from the beginning to after the NTIA transition
DOC
Reception Admin Resume
PPTX
Presentatie exercise 4 2
PDF
Ewe brochure
PDF
CP DOHA EXPERIENCE
PDF
KOWSHIKAA CONSULTANCY OVERSEAS
PDF
BMJ Open-2015-Braithwaite-
DOC
Tolios_trapezes_paragwgiki_anasygkrothsh
PDF
MS SQL BI platform
DOC
Концепция площадки ОГФ-2015 "Медиация"
PDF
வெற்றி
PDF
DODIG-2015-009
வெற்றி
ENOG 9 - RIPE vs RIPE NCC from the beginning to after the NTIA transition
வெற்றி
Skuteczna komunikacja | w 6 krokach
20150324 av vvc
See4 RIPE vs RIPE NCC from the beginning to after the NTIA transition
Reception Admin Resume
Presentatie exercise 4 2
Ewe brochure
CP DOHA EXPERIENCE
KOWSHIKAA CONSULTANCY OVERSEAS
BMJ Open-2015-Braithwaite-
Tolios_trapezes_paragwgiki_anasygkrothsh
MS SQL BI platform
Концепция площадки ОГФ-2015 "Медиация"
வெற்றி
DODIG-2015-009
Ad

Similar to Session iii(server controls) (20)

PPTX
unit4 wp.pptxjvlbpuvghuigv8ytg2ugvugvuygv
PDF
WT UNIT 2 presentation :client side technologies JavaScript And Dom
PPTX
uptu web technology unit 2 html
PDF
Html5ppt
PDF
HTML5 New and Improved
PPT
2310 b 05
PPTX
Asp PPT (.NET )
PPT
Asp.net server controls
PPTX
ASP DOT NET
PPT
The complete ASP.NET (IIS) Tutorial with code example in power point slide show
PDF
05.Blend Expression, Transformation & Animation
PDF
Best Practices in Qt Quick/QML - Part 2
 
PDF
Best Practices in Qt Quick/QML - Part 2
PPTX
PPT
ASP.NET Session 6
PPTX
Xml part 6
PDF
Silverlight 2 For Developers
PDF
Cmsc 100 (web forms)
unit4 wp.pptxjvlbpuvghuigv8ytg2ugvugvuygv
WT UNIT 2 presentation :client side technologies JavaScript And Dom
uptu web technology unit 2 html
Html5ppt
HTML5 New and Improved
2310 b 05
Asp PPT (.NET )
Asp.net server controls
ASP DOT NET
The complete ASP.NET (IIS) Tutorial with code example in power point slide show
05.Blend Expression, Transformation & Animation
Best Practices in Qt Quick/QML - Part 2
 
Best Practices in Qt Quick/QML - Part 2
ASP.NET Session 6
Xml part 6
Silverlight 2 For Developers
Cmsc 100 (web forms)

More from Shrijan Tiwari (12)

PPT
ASPX Session xi(page lifecycle)
PPT
Session x(ado.net)
PPT
Session viii(state mngtserver)
PPT
Session viii(state mngtclient)
PPT
Session vii(java scriptbasics)
PPT
Session vi(user control)
PPTX
Session v(css)
PPT
Session ix(database)
PPT
Session iv(master pages)
PPTX
Session ii(html)
PPT
Session i(introduction)
PPTX
Introduction to android
ASPX Session xi(page lifecycle)
Session x(ado.net)
Session viii(state mngtserver)
Session viii(state mngtclient)
Session vii(java scriptbasics)
Session vi(user control)
Session v(css)
Session ix(database)
Session iv(master pages)
Session ii(html)
Session i(introduction)
Introduction to android

Recently uploaded (20)

PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
Introduction to Artificial Intelligence
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PPTX
Transform Your Business with a Software ERP System
PDF
System and Network Administration Chapter 2
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
history of c programming in notes for students .pptx
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Nekopoi APK 2025 free lastest update
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
Online Work Permit System for Fast Permit Processing
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
Operating system designcfffgfgggggggvggggggggg
Which alternative to Crystal Reports is best for small or large businesses.pdf
Introduction to Artificial Intelligence
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Transform Your Business with a Software ERP System
System and Network Administration Chapter 2
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
history of c programming in notes for students .pptx
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Nekopoi APK 2025 free lastest update
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Wondershare Filmora 15 Crack With Activation Key [2025
ISO 45001 Occupational Health and Safety Management System
Odoo Companies in India – Driving Business Transformation.pdf
2025 Textile ERP Trends: SAP, Odoo & Oracle
Online Work Permit System for Fast Permit Processing
How to Choose the Right IT Partner for Your Business in Malaysia
PTS Company Brochure 2025 (1).pdf.......
Softaken Excel to vCard Converter Software.pdf
VVF-Customer-Presentation2025-Ver1.9.pptx

Session iii(server controls)

  • 1. Types of Server Controls ASP.NET Web Server Controls HTML Server Controls Creating Server Controls Dynamically
  • 2.  With ASP. Net, these are any controls that run in the server space. o Handled by ASP. Net runtime o Must have runt=“server” attribute within the ASP. Net web form o Always identified with the “ID” attribute (also mandatory with ASP. Net web controls)  Properties, events, etc. can all be handled by server-side code
  • 3. • Label • Textbox • Button • Link • Link Button • Dropdown List • List Box • Checkbox • Radio Button • Image • File Upload • Panel • <span /> • <input type=“text” /> • <input type=“submit” /> • <a href=[#|page] /> • <a href=[postback] /> • <select /> • <select [size=x] /> • <input type=“checkbox” /> • <input type=“radio” /> • <img /> • <input type=“file” /> • <div />
  • 4. • Like the ASP. Net Page object (System.Web.UI.Page), web controls maintain the same event processing – Init, PreRender, Load, etc • If AutoPostBack is set on the control, the event will be fired immediately (causes an automatic postback), otherwise, the event will fire upon next page postback • Checkbox – Check Changed() • Button – Click(), Command() • Dropdown List – Text Changed(), SelectedIndexChanged()
  • 5. • System.Web.UI.HtmlControls – Ex: HtmlButton, HtmlTable, HtmlInputText • These are ASP. Net HTML server controls – Rendered as: – <button />, <table />, <input type=“text” />
  • 6. • The HtmlControls collection allows the programmer access to HTML elements (and their properties, etc.) from server-side code – Hence, page content (HTML elements) can also be dynamically generated in the code behind or classes • All controls in this collection inherit from the HtmlControl class
  • 7. • HtmlAnchor • HtmlButton • HtmlInputButton • HtmlInputHidden • HtmlInputText • HtmlImage • HtmlSelect • HtmlTable • HtmlTextArea • HtmlGenericControl <a /> <button /> <input type=“button” /> <input type=“hidden” /> <input type=“text” /> <img /> <select /> <table /> <text area /> <span />, <body />, <h1 />, <div />…
  • 8. • Properties and Events can be managed efficiently in the code behind • Any server control can be referenced by its ID property Example: txtTextBox.Text = “Hello!”;
  • 9. • Code is written by the event handler that is defined by the control – <asp: Button On Click=“bttnGo_Click”... /> bttnGo_Click(object sender, …) { … } • This is the key to maintaining clean, efficient code for processing form data and UI interaction
  • 10. • It is good practice to prefix the name of control ID to text that indicates its “Type” o Textbox  txtName o Checkbox  chkCorrect o Dropdown List  ddlProductTypes o Panel  pnlCustInfo • This will make it easier when referring to the controls at runtime in code
  • 11. • Data – GridView – DataList – SqlDataSource – etc. • Validation (server-side) – RequiredFieldValidator – RangeValidator – RegularExpressionValidator • Navigation – SiteMapPath – Menu – TreeView – etc. • Login – Login – LoginView – etc.
  • 12. • Everything in VB/C# is an object, therefore ASP. Net server controls are objects as well • Controls can be dynamically created using server side code (VB/C#)
  • 13. Control Name Properties  RequiredFieldValidator  CompareValidator  RangeValidator  RegularExpressionValidator  CustomValidator  ValidationSummary ControlToValidate, Display , ErrorMessage,ValidationGroup, ControlToCompare, MaximumValue,MinimumValue Validation Expression Text,ClientValidationFunction, OnServerValidate Header Text