ASP.NET 02 - How ASP.NET Works

Randy Connolly
Randy ConnollyProfessor à Mount Royal University
Chapter 2 How ASP.NET Works And slowly, softly, from above the darkness is unfurled A wondrous curtain loosened on the windows of the world. Then suddenly, like magic, … Ten thousand lights flash out … Alfred Chandler, “Lights along the Mile,”   The Oxford Book of Australian Verse,  ed. Walter Murdoch, 1918.
Overview ,[object Object],[object Object],[object Object],[object Object]
Event Model ,[object Object],[object Object],[object Object],[object Object],[object Object]
Event Handlers ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],protected void Page_Load(object sender, EventArgs e) { … }
ASP.NET Event System ,[object Object],[object Object],[object Object],[object Object]
ASP.NET Event System
Postback ,[object Object],[object Object],[object Object],[object Object]
Postback
Event Types ,[object Object],[object Object],[object Object],[object Object],[object Object]
View State ,[object Object],[object Object],[object Object],<input type=&quot;hidden&quot; name=&quot;__VIEWSTATE&quot; id=&quot;__VIEWSTATE&quot;  value=&quot;/wEPDwUJODExMDE5NzY5D2QWAgIDD2QWAgIBDw8WAh4EVGV4dAUKMDgvMDE vMjAwNmRkZDZPhFHJER4chf3nmlgfL+uq4W58&quot; />
View State ,[object Object],[object Object],[object Object],[object Object]
View State ,[object Object],[object Object],[object Object]
View State ,[object Object],[object Object]
View State ,[object Object],[object Object],[object Object],[object Object]
Page Life Cycle ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Complete Page Life Cycle
Event Handlers ,[object Object],[object Object]
Event Handlers ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],<asp:Button id=&quot;btnSubmit&quot; runat=&quot;server&quot;  OnClick=&quot;btnSubmit_Click&quot;  /> btnSubmit.Click += new EventHandler( this.btnSubmit_Click );
Adding Event Handlers in VS
Event Example Please enter your name: <asp:TextBox ID=&quot;name&quot; runat=&quot;server&quot; /> <br /> Choose favorite author: <asp:DropDownList ID=&quot;myList&quot; runat=&quot;server&quot;> <asp:ListItem>Choose an author</asp:ListItem> <asp:ListItem>Atwood</asp:ListItem> <asp:ListItem>Austin</asp:ListItem> <asp:ListItem>Hawthorne</asp:ListItem> <asp:ListItem>Melville</asp:ListItem> </asp:DropDownList> <br /> <asp:Button ID=&quot;btnEnter&quot; Text=&quot;Enter&quot; runat=&quot;server&quot;  OnClick=&quot;btnEnter_Click&quot;  /> <p><asp:Label ID=&quot;msg1&quot; runat=&quot;server&quot; /></p>
Event Example … public partial class EventTest: Page { protected void Page_Load(object sender, EventArgs e) { msg1.Text = &quot;In Page_Load<br/>&quot;; } protected void btnEnter_Click(object sender, EventArgs e) { if (myList.SelectedIndex > 0) { msg1.Text += &quot;Hi &quot; + name.Text + &quot;<br/>&quot;; msg1.Text += &quot;Your favorite author is &quot;; msg1.Text += myList.SelectedItem; } } }
Detecting Postback ,[object Object],[object Object],[object Object]
Detecting Postback ,[object Object],[object Object],protected void Page_Load(object sender, EventArgs e) { … if (!  IsPostBack ) { // Do something here for very first request } … }
Postback and Non-Postback Controls ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Change Events ,[object Object],[object Object],[object Object]
Using AutoPostBack Choose favorite author: <asp:DropDownList ID=&quot;myList&quot; runat=&quot;server&quot; AutoPostBack=&quot;true&quot;   OnSelectedIndexChanged=&quot;myList_SelectedIndexChanged&quot;  > <asp:ListItem>Choose an author</asp:ListItem> <asp:ListItem>Atwood</asp:ListItem> <asp:ListItem>Austin</asp:ListItem> <asp:ListItem>Hawthorne</asp:ListItem> <asp:ListItem>Melville</asp:ListItem> </asp:DropDownList> <p><asp:Label ID=&quot;msg1&quot; runat=&quot;server&quot; /></p> protected void myList_SelectedIndexChanged(object sender, EventArgs e) { // Ignore first item in list if (myList.SelectedIndex > 0) { msg1.Text += &quot;Hi &quot; + name.Text + &quot;<br/>&quot;; msg1.Text += &quot;Your favorite author is &quot;; msg1.Text += myList.SelectedItem; } }
ASP.NET Behind the Scenes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
ASP.NET 2.0 Compilation Process
Where is this stuff? ,[object Object],[object Object],[object Object],C:INDOWSicrosoft.NETramework2.0.50727emporary ASP.NET Fileshapter2229f9fdd0746a9.
Page  class ,[object Object]
ASP.NET 2.0 Class Inheritance
Page  class ,[object Object],[object Object],[object Object]
Application Lifecycle ,[object Object]
Application Lifecycle
1 sur 34

Recommandé

Csphtp1 20 par
Csphtp1 20Csphtp1 20
Csphtp1 20HUST
12.6K vues126 diapositives
Web II - 02 - How ASP.NET Works par
Web II - 02 - How ASP.NET WorksWeb II - 02 - How ASP.NET Works
Web II - 02 - How ASP.NET WorksRandy Connolly
10.4K vues98 diapositives
ASP.NET 12 - State Management par
ASP.NET 12 - State ManagementASP.NET 12 - State Management
ASP.NET 12 - State ManagementRandy Connolly
3.3K vues37 diapositives
Ajax par
AjaxAjax
AjaxRathan Raj
1.5K vues19 diapositives
AJAX par
AJAXAJAX
AJAXGouthaman V
561 vues27 diapositives
Asp.net By Durgesh Singh par
Asp.net By Durgesh SinghAsp.net By Durgesh Singh
Asp.net By Durgesh Singhimdurgesh
313 vues40 diapositives

Contenu connexe

Tendances

JSP Error handling par
JSP Error handlingJSP Error handling
JSP Error handlingkamal kotecha
7.6K vues22 diapositives
RicoAjaxEngine par
RicoAjaxEngineRicoAjaxEngine
RicoAjaxEnginetutorialsruby
313 vues10 diapositives
Ajax and ASP.NET AJAX par
Ajax and ASP.NET AJAXAjax and ASP.NET AJAX
Ajax and ASP.NET AJAXJulie Iskander
3.7K vues52 diapositives
Ajax control tool kit par
Ajax control tool kitAjax control tool kit
Ajax control tool kitVidhi Patel
4.4K vues48 diapositives
Ajax par
AjaxAjax
AjaxTSUBHASHRI
1.1K vues19 diapositives
Ajax par
AjaxAjax
Ajaxhusnara mohammad
275 vues34 diapositives

En vedette

CSS Basics par
CSS BasicsCSS Basics
CSS BasicsHossein Zahed
1.4K vues10 diapositives
Big Data World par
Big Data WorldBig Data World
Big Data WorldHossein Zahed
6.8K vues80 diapositives
Entity Framework Overview par
Entity Framework OverviewEntity Framework Overview
Entity Framework Overviewukdpe
2.7K vues23 diapositives
ASP.NET MVC 5 - EF 6 - VS2015 par
ASP.NET MVC 5 - EF 6 - VS2015ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015Hossein Zahed
3.4K vues148 diapositives
HTML & XHTML Basics par
HTML & XHTML BasicsHTML & XHTML Basics
HTML & XHTML BasicsHossein Zahed
3.1K vues37 diapositives
CSharp Language Overview Part 1 par
CSharp Language Overview Part 1CSharp Language Overview Part 1
CSharp Language Overview Part 1Hossein Zahed
1.8K vues126 diapositives

En vedette(16)

Entity Framework Overview par ukdpe
Entity Framework OverviewEntity Framework Overview
Entity Framework Overview
ukdpe2.7K vues
ASP.NET MVC 5 - EF 6 - VS2015 par Hossein Zahed
ASP.NET MVC 5 - EF 6 - VS2015ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015
Hossein Zahed3.4K vues
CSharp Language Overview Part 1 par Hossein Zahed
CSharp Language Overview Part 1CSharp Language Overview Part 1
CSharp Language Overview Part 1
Hossein Zahed1.8K vues
ASP.NET Page Life Cycle par Abhishek Sur
ASP.NET Page Life CycleASP.NET Page Life Cycle
ASP.NET Page Life Cycle
Abhishek Sur33.8K vues
Introduction to angular js for .net developers par Mohd Manzoor Ahmed
Introduction to angular js  for .net developersIntroduction to angular js  for .net developers
Introduction to angular js for .net developers
Mohd Manzoor Ahmed2.1K vues
Technologies that will disappear in next 5 years par Shrey Kapoor
Technologies that will disappear in next 5 yearsTechnologies that will disappear in next 5 years
Technologies that will disappear in next 5 years
Shrey Kapoor34K vues
Basic c++ programs par harman kaur
Basic c++ programsBasic c++ programs
Basic c++ programs
harman kaur16.3K vues
Developing an ASP.NET Web Application par Rishi Kothari
Developing an ASP.NET Web ApplicationDeveloping an ASP.NET Web Application
Developing an ASP.NET Web Application
Rishi Kothari28.4K vues
2008: Web Application Security Tutorial par Neil Matatall
2008: Web Application Security Tutorial2008: Web Application Security Tutorial
2008: Web Application Security Tutorial
Neil Matatall30.9K vues

Similaire à ASP.NET 02 - How ASP.NET Works

Vb.Net Web Forms par
Vb.Net  Web FormsVb.Net  Web Forms
Vb.Net Web FormsDutch Dasanaike {LION}
5.2K vues16 diapositives
2310 b 05 par
2310 b 052310 b 05
2310 b 05Krazy Koder
996 vues26 diapositives
Ajax par
AjaxAjax
Ajaxdevisp
593 vues19 diapositives
ASP.NET MVC introduction par
ASP.NET MVC introductionASP.NET MVC introduction
ASP.NET MVC introductionTomi Juhola
2.7K vues37 diapositives
Aspnet2 Overview par
Aspnet2 OverviewAspnet2 Overview
Aspnet2 Overviewajitbergi
1.8K vues66 diapositives
2 Asp Dot Net Ajax Extensions par
2 Asp Dot Net Ajax Extensions2 Asp Dot Net Ajax Extensions
2 Asp Dot Net Ajax ExtensionsAbhishek Bhatnagar
4.2K vues43 diapositives

Similaire à ASP.NET 02 - How ASP.NET Works(20)

Ajax par devisp
AjaxAjax
Ajax
devisp593 vues
ASP.NET MVC introduction par Tomi Juhola
ASP.NET MVC introductionASP.NET MVC introduction
ASP.NET MVC introduction
Tomi Juhola2.7K vues
Aspnet2 Overview par ajitbergi
Aspnet2 OverviewAspnet2 Overview
Aspnet2 Overview
ajitbergi1.8K vues
AJAX ASP.Net par SHC
AJAX ASP.NetAJAX ASP.Net
AJAX ASP.Net
SHC729 vues
ASP.NET 05 - Exception Handling And Validation Controls par Randy Connolly
ASP.NET 05 - Exception Handling And Validation ControlsASP.NET 05 - Exception Handling And Validation Controls
ASP.NET 05 - Exception Handling And Validation Controls
Randy Connolly3K vues
Web Services Part 2 par patinijava
Web Services Part 2Web Services Part 2
Web Services Part 2
patinijava1.7K vues
Struts2 par yuvalb
Struts2Struts2
Struts2
yuvalb2.7K vues
C sharp and asp.net interview questions par Akhil Mittal
C sharp and asp.net interview questionsC sharp and asp.net interview questions
C sharp and asp.net interview questions
Akhil Mittal1.2K vues
Esposito Ajax Remote par ask bills
Esposito Ajax RemoteEsposito Ajax Remote
Esposito Ajax Remote
ask bills941 vues

Plus de Randy Connolly

Ten-Year Anniversary of our CIS Degree par
Ten-Year Anniversary of our CIS DegreeTen-Year Anniversary of our CIS Degree
Ten-Year Anniversary of our CIS DegreeRandy Connolly
301 vues12 diapositives
Careers in Computing (2019 Edition) par
Careers in Computing (2019 Edition)Careers in Computing (2019 Edition)
Careers in Computing (2019 Edition)Randy Connolly
123 vues35 diapositives
Facing Backwards While Stumbling Forwards: The Future of Teaching Web Develop... par
Facing Backwards While Stumbling Forwards: The Future of Teaching Web Develop...Facing Backwards While Stumbling Forwards: The Future of Teaching Web Develop...
Facing Backwards While Stumbling Forwards: The Future of Teaching Web Develop...Randy Connolly
92 vues49 diapositives
Where is the Internet? (2019 Edition) par
Where is the Internet? (2019 Edition)Where is the Internet? (2019 Edition)
Where is the Internet? (2019 Edition)Randy Connolly
85 vues78 diapositives
Modern Web Development (2018) par
Modern Web Development (2018)Modern Web Development (2018)
Modern Web Development (2018)Randy Connolly
118 vues83 diapositives
Helping Prospective Students Understand the Computing Disciplines par
Helping Prospective Students Understand the Computing DisciplinesHelping Prospective Students Understand the Computing Disciplines
Helping Prospective Students Understand the Computing DisciplinesRandy Connolly
157 vues56 diapositives

Plus de Randy Connolly(20)

Ten-Year Anniversary of our CIS Degree par Randy Connolly
Ten-Year Anniversary of our CIS DegreeTen-Year Anniversary of our CIS Degree
Ten-Year Anniversary of our CIS Degree
Randy Connolly301 vues
Careers in Computing (2019 Edition) par Randy Connolly
Careers in Computing (2019 Edition)Careers in Computing (2019 Edition)
Careers in Computing (2019 Edition)
Randy Connolly123 vues
Facing Backwards While Stumbling Forwards: The Future of Teaching Web Develop... par Randy Connolly
Facing Backwards While Stumbling Forwards: The Future of Teaching Web Develop...Facing Backwards While Stumbling Forwards: The Future of Teaching Web Develop...
Facing Backwards While Stumbling Forwards: The Future of Teaching Web Develop...
Randy Connolly92 vues
Where is the Internet? (2019 Edition) par Randy Connolly
Where is the Internet? (2019 Edition)Where is the Internet? (2019 Edition)
Where is the Internet? (2019 Edition)
Randy Connolly85 vues
Helping Prospective Students Understand the Computing Disciplines par Randy Connolly
Helping Prospective Students Understand the Computing DisciplinesHelping Prospective Students Understand the Computing Disciplines
Helping Prospective Students Understand the Computing Disciplines
Randy Connolly157 vues
Constructing a Web Development Textbook par Randy Connolly
Constructing a Web Development TextbookConstructing a Web Development Textbook
Constructing a Web Development Textbook
Randy Connolly91 vues
Disrupting the Discourse of the "Digital Disruption of _____" par Randy Connolly
Disrupting the Discourse of the "Digital Disruption of _____"Disrupting the Discourse of the "Digital Disruption of _____"
Disrupting the Discourse of the "Digital Disruption of _____"
Randy Connolly77 vues
Red Fish Blue Fish: Reexamining Student Understanding of the Computing Discip... par Randy Connolly
Red Fish Blue Fish: Reexamining Student Understanding of the Computing Discip...Red Fish Blue Fish: Reexamining Student Understanding of the Computing Discip...
Red Fish Blue Fish: Reexamining Student Understanding of the Computing Discip...
Randy Connolly54 vues
Constructing and revising a web development textbook par Randy Connolly
Constructing and revising a web development textbookConstructing and revising a web development textbook
Constructing and revising a web development textbook
Randy Connolly828 vues
Computing is Not a Rock Band: Student Understanding of the Computing Disciplines par Randy Connolly
Computing is Not a Rock Band: Student Understanding of the Computing DisciplinesComputing is Not a Rock Band: Student Understanding of the Computing Disciplines
Computing is Not a Rock Band: Student Understanding of the Computing Disciplines
Randy Connolly920 vues
Citizenship: How do leaders in universities think about and experience citize... par Randy Connolly
Citizenship: How do leaders in universities think about and experience citize...Citizenship: How do leaders in universities think about and experience citize...
Citizenship: How do leaders in universities think about and experience citize...
Randy Connolly583 vues
A longitudinal examination of SIGITE conference submission data par Randy Connolly
A longitudinal examination of SIGITE conference submission dataA longitudinal examination of SIGITE conference submission data
A longitudinal examination of SIGITE conference submission data
Randy Connolly872 vues
Is Human Flourishing in the ICT World of the Future Likely? par Randy Connolly
Is Human Flourishing in the ICT World of the Future Likely?Is Human Flourishing in the ICT World of the Future Likely?
Is Human Flourishing in the ICT World of the Future Likely?
Randy Connolly3.4K vues
Constructing a Contemporary Textbook par Randy Connolly
Constructing a Contemporary TextbookConstructing a Contemporary Textbook
Constructing a Contemporary Textbook
Randy Connolly659 vues

Dernier

The Research Portal of Catalonia: Growing more (information) & more (services) par
The Research Portal of Catalonia: Growing more (information) & more (services)The Research Portal of Catalonia: Growing more (information) & more (services)
The Research Portal of Catalonia: Growing more (information) & more (services)CSUC - Consorci de Serveis Universitaris de Catalunya
66 vues25 diapositives
Samsung: CMM-H Tiered Memory Solution with Built-in DRAM par
Samsung: CMM-H Tiered Memory Solution with Built-in DRAMSamsung: CMM-H Tiered Memory Solution with Built-in DRAM
Samsung: CMM-H Tiered Memory Solution with Built-in DRAMCXL Forum
105 vues7 diapositives
Five Things You SHOULD Know About Postman par
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About PostmanPostman
25 vues43 diapositives
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu... par
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...NUS-ISS
32 vues54 diapositives
[2023] Putting the R! in R&D.pdf par
[2023] Putting the R! in R&D.pdf[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdfEleanor McHugh
38 vues127 diapositives
"How we switched to Kanban and how it integrates with product planning", Vady... par
"How we switched to Kanban and how it integrates with product planning", Vady..."How we switched to Kanban and how it integrates with product planning", Vady...
"How we switched to Kanban and how it integrates with product planning", Vady...Fwdays
61 vues24 diapositives

Dernier(20)

Samsung: CMM-H Tiered Memory Solution with Built-in DRAM par CXL Forum
Samsung: CMM-H Tiered Memory Solution with Built-in DRAMSamsung: CMM-H Tiered Memory Solution with Built-in DRAM
Samsung: CMM-H Tiered Memory Solution with Built-in DRAM
CXL Forum105 vues
Five Things You SHOULD Know About Postman par Postman
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About Postman
Postman25 vues
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu... par NUS-ISS
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...
NUS-ISS32 vues
"How we switched to Kanban and how it integrates with product planning", Vady... par Fwdays
"How we switched to Kanban and how it integrates with product planning", Vady..."How we switched to Kanban and how it integrates with product planning", Vady...
"How we switched to Kanban and how it integrates with product planning", Vady...
Fwdays61 vues
JCon Live 2023 - Lice coding some integration problems par Bernd Ruecker
JCon Live 2023 - Lice coding some integration problemsJCon Live 2023 - Lice coding some integration problems
JCon Live 2023 - Lice coding some integration problems
Bernd Ruecker67 vues
Data-centric AI and the convergence of data and model engineering: opportunit... par Paolo Missier
Data-centric AI and the convergence of data and model engineering:opportunit...Data-centric AI and the convergence of data and model engineering:opportunit...
Data-centric AI and the convergence of data and model engineering: opportunit...
Paolo Missier29 vues
Understanding GenAI/LLM and What is Google Offering - Felix Goh par NUS-ISS
Understanding GenAI/LLM and What is Google Offering - Felix GohUnderstanding GenAI/LLM and What is Google Offering - Felix Goh
Understanding GenAI/LLM and What is Google Offering - Felix Goh
NUS-ISS39 vues
Liqid: Composable CXL Preview par CXL Forum
Liqid: Composable CXL PreviewLiqid: Composable CXL Preview
Liqid: Composable CXL Preview
CXL Forum121 vues
MemVerge: Past Present and Future of CXL par CXL Forum
MemVerge: Past Present and Future of CXLMemVerge: Past Present and Future of CXL
MemVerge: Past Present and Future of CXL
CXL Forum110 vues
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen... par NUS-ISS
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...
NUS-ISS23 vues
"Thriving Culture in a Product Company — Practical Story", Volodymyr Tsukur par Fwdays
"Thriving Culture in a Product Company — Practical Story", Volodymyr Tsukur"Thriving Culture in a Product Company — Practical Story", Volodymyr Tsukur
"Thriving Culture in a Product Company — Practical Story", Volodymyr Tsukur
Fwdays40 vues
Spesifikasi Lengkap ASUS Vivobook Go 14 par Dot Semarang
Spesifikasi Lengkap ASUS Vivobook Go 14Spesifikasi Lengkap ASUS Vivobook Go 14
Spesifikasi Lengkap ASUS Vivobook Go 14
Dot Semarang35 vues
GigaIO: The March of Composability Onward to Memory with CXL par CXL Forum
GigaIO: The March of Composability Onward to Memory with CXLGigaIO: The March of Composability Onward to Memory with CXL
GigaIO: The March of Composability Onward to Memory with CXL
CXL Forum126 vues
"Fast Start to Building on AWS", Igor Ivaniuk par Fwdays
"Fast Start to Building on AWS", Igor Ivaniuk"Fast Start to Building on AWS", Igor Ivaniuk
"Fast Start to Building on AWS", Igor Ivaniuk
Fwdays36 vues
PharoJS - Zürich Smalltalk Group Meetup November 2023 par Noury Bouraqadi
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023
Noury Bouraqadi113 vues
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor... par Vadym Kazulkin
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
Vadym Kazulkin70 vues
MemVerge: Memory Viewer Software par CXL Forum
MemVerge: Memory Viewer SoftwareMemVerge: Memory Viewer Software
MemVerge: Memory Viewer Software
CXL Forum118 vues

ASP.NET 02 - How ASP.NET Works

  • 1. Chapter 2 How ASP.NET Works And slowly, softly, from above the darkness is unfurled A wondrous curtain loosened on the windows of the world. Then suddenly, like magic, … Ten thousand lights flash out … Alfred Chandler, “Lights along the Mile,” The Oxford Book of Australian Verse, ed. Walter Murdoch, 1918.
  • 2.
  • 3.
  • 4.
  • 5.
  • 7.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 17.
  • 18.
  • 20. Event Example Please enter your name: <asp:TextBox ID=&quot;name&quot; runat=&quot;server&quot; /> <br /> Choose favorite author: <asp:DropDownList ID=&quot;myList&quot; runat=&quot;server&quot;> <asp:ListItem>Choose an author</asp:ListItem> <asp:ListItem>Atwood</asp:ListItem> <asp:ListItem>Austin</asp:ListItem> <asp:ListItem>Hawthorne</asp:ListItem> <asp:ListItem>Melville</asp:ListItem> </asp:DropDownList> <br /> <asp:Button ID=&quot;btnEnter&quot; Text=&quot;Enter&quot; runat=&quot;server&quot; OnClick=&quot;btnEnter_Click&quot; /> <p><asp:Label ID=&quot;msg1&quot; runat=&quot;server&quot; /></p>
  • 21. Event Example … public partial class EventTest: Page { protected void Page_Load(object sender, EventArgs e) { msg1.Text = &quot;In Page_Load<br/>&quot;; } protected void btnEnter_Click(object sender, EventArgs e) { if (myList.SelectedIndex > 0) { msg1.Text += &quot;Hi &quot; + name.Text + &quot;<br/>&quot;; msg1.Text += &quot;Your favorite author is &quot;; msg1.Text += myList.SelectedItem; } } }
  • 22.
  • 23.
  • 24.
  • 25.
  • 26. Using AutoPostBack Choose favorite author: <asp:DropDownList ID=&quot;myList&quot; runat=&quot;server&quot; AutoPostBack=&quot;true&quot; OnSelectedIndexChanged=&quot;myList_SelectedIndexChanged&quot; > <asp:ListItem>Choose an author</asp:ListItem> <asp:ListItem>Atwood</asp:ListItem> <asp:ListItem>Austin</asp:ListItem> <asp:ListItem>Hawthorne</asp:ListItem> <asp:ListItem>Melville</asp:ListItem> </asp:DropDownList> <p><asp:Label ID=&quot;msg1&quot; runat=&quot;server&quot; /></p> protected void myList_SelectedIndexChanged(object sender, EventArgs e) { // Ignore first item in list if (myList.SelectedIndex > 0) { msg1.Text += &quot;Hi &quot; + name.Text + &quot;<br/>&quot;; msg1.Text += &quot;Your favorite author is &quot;; msg1.Text += myList.SelectedItem; } }
  • 27.
  • 29.
  • 30.
  • 31. ASP.NET 2.0 Class Inheritance
  • 32.
  • 33.