SlideShare a Scribd company logo
1 of 10
Writing Code
 Writing code in an ASP.NET Web form is done in three
ways:
 Mixed code method
 The code is in the same file as the web content, mixed with the
HTML code
 This method is not recommended as the source code is hard
to read and maintain
 Inline code method
 Code-behind method
2
Writing Code (2)
 Writing code in an ASP.NET web form is done in three
ways:
 Mixed code method
 Inline code method
 The code is separated in a SCRIPT section in the same file
 Code-behind method
3
Writing Code (3)
 Writing code in an ASP.NET web form is done in three
ways:
 Mixed code method
 Inline code method
 Code-behind method
 The code is in the code-behind page – a separate file from the
HTML content
 When using Visual Studio .NET this is the default method
4
Example: Inline Code Method
5
<html>
<asp:Button id="btn" runat="server"/>
...
</html>
<script Language="c#" runat="server">
private void btn_Click(object sender,
System.EventArgs e)
{
...
}
</script>
Code-behind Model
 A separate compiled file containing the program logic of
the page
 Each web page has its own code-behind page
 Has the same name as the web page to which it is attached
 The file extension is .aspx.cs
 The two files are built into one when the application is
started
7
How Does Code-behind Work?
 To associate an .aspx page to its code-behind class the
@Page directive is used
 VS.NET adds three attributes to the @Page directive:
 Inherits – allows the .aspx page to derive from the
code-behind class
 Codebehind – used internally by Visual Studio .NET to
associate the files
 Src – contains the name of the code-behind page
 Used if the application is not precompiled
8
JIT Compilation
 The Code-behind page can be either precompiled or just-
in-time (JIT) Compiled
 JIT compilation
 A compilation at first request
 Set by the Src attribute of the @Page directive
 VS.NET doesn’t add it by default
9
Precompilation
 Precompilation
 Avoids the delay at first request
 Simplifies the deployment of the web application
 The source code of the code-behind class is not
necessary
10

More Related Content

What's hot

ASP Dot Net Software Development in India - iFour Technolab
ASP Dot Net Software Development in India - iFour TechnolabASP Dot Net Software Development in India - iFour Technolab
ASP Dot Net Software Development in India - iFour TechnolabiFour Technolab Pvt. Ltd.
 
Inventory management project based on ASP.NET, introduction to C# and ASP.NET
Inventory management project based on ASP.NET, introduction to C# and ASP.NETInventory management project based on ASP.NET, introduction to C# and ASP.NET
Inventory management project based on ASP.NET, introduction to C# and ASP.NETHimanshu Patel
 
Asp.net architecture
Asp.net architectureAsp.net architecture
Asp.net architectureIblesoft
 
Microsoft .NET Development Platform Internationalization
Microsoft .NET Development Platform InternationalizationMicrosoft .NET Development Platform Internationalization
Microsoft .NET Development Platform InternationalizationRishi Kothari
 
REPORT ON ASP.NET
REPORT ON ASP.NETREPORT ON ASP.NET
REPORT ON ASP.NETLOKESH
 
Developing an ASP.NET Web Application
Developing an ASP.NET Web ApplicationDeveloping an ASP.NET Web Application
Developing an ASP.NET Web ApplicationRishi Kothari
 
Public Library
Public LibraryPublic Library
Public Libraryeclumson
 
Empowerment Technologies Lecture 11 (Philippines SHS)
Empowerment Technologies Lecture 11 (Philippines SHS)Empowerment Technologies Lecture 11 (Philippines SHS)
Empowerment Technologies Lecture 11 (Philippines SHS)John Bosco Javellana, MAEd.
 
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 FormsSAMIR BHOGAYTA
 
Asp net mvc
Asp net mvcAsp net mvc
Asp net mvcbgrynko
 
Asp.net and .Net Framework ppt presentation
Asp.net and .Net Framework ppt presentationAsp.net and .Net Framework ppt presentation
Asp.net and .Net Framework ppt presentationabhishek singh
 
Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9AHM Pervej Kabir
 
Membangun Desktop App
Membangun Desktop AppMembangun Desktop App
Membangun Desktop AppFajar Baskoro
 

What's hot (20)

ASP.NET OVERVIEW
ASP.NET OVERVIEWASP.NET OVERVIEW
ASP.NET OVERVIEW
 
Asp.netrole
Asp.netroleAsp.netrole
Asp.netrole
 
Asp.net
Asp.netAsp.net
Asp.net
 
ASP Dot Net Software Development in India - iFour Technolab
ASP Dot Net Software Development in India - iFour TechnolabASP Dot Net Software Development in India - iFour Technolab
ASP Dot Net Software Development in India - iFour Technolab
 
Inventory management project based on ASP.NET, introduction to C# and ASP.NET
Inventory management project based on ASP.NET, introduction to C# and ASP.NETInventory management project based on ASP.NET, introduction to C# and ASP.NET
Inventory management project based on ASP.NET, introduction to C# and ASP.NET
 
Asp.net architecture
Asp.net architectureAsp.net architecture
Asp.net architecture
 
Microsoft .NET Development Platform Internationalization
Microsoft .NET Development Platform InternationalizationMicrosoft .NET Development Platform Internationalization
Microsoft .NET Development Platform Internationalization
 
2310 b 01
2310 b 012310 b 01
2310 b 01
 
REPORT ON ASP.NET
REPORT ON ASP.NETREPORT ON ASP.NET
REPORT ON ASP.NET
 
Developing an ASP.NET Web Application
Developing an ASP.NET Web ApplicationDeveloping an ASP.NET Web Application
Developing an ASP.NET Web Application
 
Public Library
Public LibraryPublic Library
Public Library
 
Asp notes
Asp notesAsp notes
Asp notes
 
Empowerment Technologies Lecture 11 (Philippines SHS)
Empowerment Technologies Lecture 11 (Philippines SHS)Empowerment Technologies Lecture 11 (Philippines SHS)
Empowerment Technologies Lecture 11 (Philippines SHS)
 
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
 
Asp net
Asp netAsp net
Asp net
 
Asp net mvc
Asp net mvcAsp net mvc
Asp net mvc
 
Asp.net and .Net Framework ppt presentation
Asp.net and .Net Framework ppt presentationAsp.net and .Net Framework ppt presentation
Asp.net and .Net Framework ppt presentation
 
Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9
 
Facebook APIs
Facebook APIsFacebook APIs
Facebook APIs
 
Membangun Desktop App
Membangun Desktop AppMembangun Desktop App
Membangun Desktop App
 

Viewers also liked

Paula Elvira Espinosa
Paula Elvira EspinosaPaula Elvira Espinosa
Paula Elvira Espinosapaula2611
 
La utilización del correo electrónico en la escuela
La utilización del correo electrónico en la escuelaLa utilización del correo electrónico en la escuela
La utilización del correo electrónico en la escuelaPATRICIA MONTIEL
 
Ejemplos de herramientas case más utilizadas
Ejemplos de herramientas case más utilizadasEjemplos de herramientas case más utilizadas
Ejemplos de herramientas case más utilizadasKenny Cash
 
El oficio de enseñar Condiciones y Contextos. Capitulo 5 Edith Litwin
El oficio de enseñar Condiciones y Contextos. Capitulo 5 Edith LitwinEl oficio de enseñar Condiciones y Contextos. Capitulo 5 Edith Litwin
El oficio de enseñar Condiciones y Contextos. Capitulo 5 Edith LitwinMaria Laura Villalba
 
Tecnologia Educativa
Tecnologia EducativaTecnologia Educativa
Tecnologia EducativaJesús GM
 

Viewers also liked (7)

Paula Elvira Espinosa
Paula Elvira EspinosaPaula Elvira Espinosa
Paula Elvira Espinosa
 
La utilización del correo electrónico en la escuela
La utilización del correo electrónico en la escuelaLa utilización del correo electrónico en la escuela
La utilización del correo electrónico en la escuela
 
Las nuevas-tecnologias
Las nuevas-tecnologiasLas nuevas-tecnologias
Las nuevas-tecnologias
 
Ejemplos de herramientas case más utilizadas
Ejemplos de herramientas case más utilizadasEjemplos de herramientas case más utilizadas
Ejemplos de herramientas case más utilizadas
 
El oficio de enseñar Condiciones y Contextos. Capitulo 5 Edith Litwin
El oficio de enseñar Condiciones y Contextos. Capitulo 5 Edith LitwinEl oficio de enseñar Condiciones y Contextos. Capitulo 5 Edith Litwin
El oficio de enseñar Condiciones y Contextos. Capitulo 5 Edith Litwin
 
Tecnología educativa
Tecnología educativaTecnología educativa
Tecnología educativa
 
Tecnologia Educativa
Tecnologia EducativaTecnologia Educativa
Tecnologia Educativa
 

Similar to Code model

01 asp.net session01
01 asp.net session0101 asp.net session01
01 asp.net session01Vivek chan
 
Introduction to asp.net
Introduction to asp.netIntroduction to asp.net
Introduction to asp.netSHADAB ALI
 
Chapter 1 (asp.net over view)
Chapter 1 (asp.net over view)Chapter 1 (asp.net over view)
Chapter 1 (asp.net over view)let's go to study
 
ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET PresentationRasel Khan
 
Asp.Net 2.0 Presentation
Asp.Net 2.0 PresentationAsp.Net 2.0 Presentation
Asp.Net 2.0 Presentationsasidhar
 
Asp.net With mvc handson
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handsonPrashant Kumar
 
Asp.net c# MVC-5 Training-Day-2 of Day-9
Asp.net c# MVC-5 Training-Day-2 of Day-9Asp.net c# MVC-5 Training-Day-2 of Day-9
Asp.net c# MVC-5 Training-Day-2 of Day-9AHM Pervej Kabir
 
Top 15-asp-dot-net-interview-questions-and-answers
Top 15-asp-dot-net-interview-questions-and-answersTop 15-asp-dot-net-interview-questions-and-answers
Top 15-asp-dot-net-interview-questions-and-answerssonia merchant
 
Top 15 asp dot net interview questions and answers
Top 15 asp dot net interview questions and answersTop 15 asp dot net interview questions and answers
Top 15 asp dot net interview questions and answersPooja Gaikwad
 
01 asp.net session01
01 asp.net session0101 asp.net session01
01 asp.net session01Mani Chaubey
 
Web matrix part 2
Web matrix part 2Web matrix part 2
Web matrix part 2yuvaraj72
 
ASP, ASP.NET, JSP, COM/DCOM
ASP, ASP.NET, JSP, COM/DCOMASP, ASP.NET, JSP, COM/DCOM
ASP, ASP.NET, JSP, COM/DCOMAashish Jain
 
Programming is Fun with ASP.NET MVC
Programming is Fun with ASP.NET MVCProgramming is Fun with ASP.NET MVC
Programming is Fun with ASP.NET MVCIan Carnaghan
 

Similar to Code model (20)

01 asp.net session01
01 asp.net session0101 asp.net session01
01 asp.net session01
 
Introduction to asp.net
Introduction to asp.netIntroduction to asp.net
Introduction to asp.net
 
Chapter 1 (asp.net over view)
Chapter 1 (asp.net over view)Chapter 1 (asp.net over view)
Chapter 1 (asp.net over view)
 
As pnet
As pnetAs pnet
As pnet
 
ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET Presentation
 
Asp.Net 2.0 Presentation
Asp.Net 2.0 PresentationAsp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
 
Asp.net With mvc handson
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handson
 
Asp.net
Asp.netAsp.net
Asp.net
 
A comprehensive software infrastructure of .Net
A comprehensive software infrastructure of .Net  A comprehensive software infrastructure of .Net
A comprehensive software infrastructure of .Net
 
Asp.net c# MVC-5 Training-Day-2 of Day-9
Asp.net c# MVC-5 Training-Day-2 of Day-9Asp.net c# MVC-5 Training-Day-2 of Day-9
Asp.net c# MVC-5 Training-Day-2 of Day-9
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
 
Top 15-asp-dot-net-interview-questions-and-answers
Top 15-asp-dot-net-interview-questions-and-answersTop 15-asp-dot-net-interview-questions-and-answers
Top 15-asp-dot-net-interview-questions-and-answers
 
Top 15 asp dot net interview questions and answers
Top 15 asp dot net interview questions and answersTop 15 asp dot net interview questions and answers
Top 15 asp dot net interview questions and answers
 
01 asp.net session01
01 asp.net session0101 asp.net session01
01 asp.net session01
 
Asp.net
Asp.netAsp.net
Asp.net
 
Web matrix part 2
Web matrix part 2Web matrix part 2
Web matrix part 2
 
ASP, ASP.NET, JSP, COM/DCOM
ASP, ASP.NET, JSP, COM/DCOMASP, ASP.NET, JSP, COM/DCOM
ASP, ASP.NET, JSP, COM/DCOM
 
Introduction to asp
Introduction to aspIntroduction to asp
Introduction to asp
 
Programming is Fun with ASP.NET MVC
Programming is Fun with ASP.NET MVCProgramming is Fun with ASP.NET MVC
Programming is Fun with ASP.NET MVC
 
ASP.NET - Web Programming
ASP.NET - Web ProgrammingASP.NET - Web Programming
ASP.NET - Web Programming
 

More from teach4uin

Master pages
Master pagesMaster pages
Master pagesteach4uin
 
.Net framework
.Net framework.Net framework
.Net frameworkteach4uin
 
Scripting languages
Scripting languagesScripting languages
Scripting languagesteach4uin
 
State management
State managementState management
State managementteach4uin
 
security configuration
security configurationsecurity configuration
security configurationteach4uin
 
static dynamic html tags
 static dynamic html tags static dynamic html tags
static dynamic html tagsteach4uin
 
static dynamic html tags
static dynamic html tagsstatic dynamic html tags
static dynamic html tagsteach4uin
 
New microsoft office power point presentation
New microsoft office power point presentationNew microsoft office power point presentation
New microsoft office power point presentationteach4uin
 
.Net overview
.Net overview.Net overview
.Net overviewteach4uin
 
Stdlib functions lesson
Stdlib functions lessonStdlib functions lesson
Stdlib functions lessonteach4uin
 
storage clas
storage classtorage clas
storage clasteach4uin
 
Cprogrammingprogramcontrols
CprogrammingprogramcontrolsCprogrammingprogramcontrols
Cprogrammingprogramcontrolsteach4uin
 

More from teach4uin (20)

Controls
ControlsControls
Controls
 
validation
validationvalidation
validation
 
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
 
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
 

Recently uploaded

MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 

Recently uploaded (20)

MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 

Code model

  • 1.
  • 2. Writing Code  Writing code in an ASP.NET Web form is done in three ways:  Mixed code method  The code is in the same file as the web content, mixed with the HTML code  This method is not recommended as the source code is hard to read and maintain  Inline code method  Code-behind method 2
  • 3. Writing Code (2)  Writing code in an ASP.NET web form is done in three ways:  Mixed code method  Inline code method  The code is separated in a SCRIPT section in the same file  Code-behind method 3
  • 4. Writing Code (3)  Writing code in an ASP.NET web form is done in three ways:  Mixed code method  Inline code method  Code-behind method  The code is in the code-behind page – a separate file from the HTML content  When using Visual Studio .NET this is the default method 4
  • 5. Example: Inline Code Method 5 <html> <asp:Button id="btn" runat="server"/> ... </html> <script Language="c#" runat="server"> private void btn_Click(object sender, System.EventArgs e) { ... } </script>
  • 6.
  • 7. Code-behind Model  A separate compiled file containing the program logic of the page  Each web page has its own code-behind page  Has the same name as the web page to which it is attached  The file extension is .aspx.cs  The two files are built into one when the application is started 7
  • 8. How Does Code-behind Work?  To associate an .aspx page to its code-behind class the @Page directive is used  VS.NET adds three attributes to the @Page directive:  Inherits – allows the .aspx page to derive from the code-behind class  Codebehind – used internally by Visual Studio .NET to associate the files  Src – contains the name of the code-behind page  Used if the application is not precompiled 8
  • 9. JIT Compilation  The Code-behind page can be either precompiled or just- in-time (JIT) Compiled  JIT compilation  A compilation at first request  Set by the Src attribute of the @Page directive  VS.NET doesn’t add it by default 9
  • 10. Precompilation  Precompilation  Avoids the delay at first request  Simplifies the deployment of the web application  The source code of the code-behind class is not necessary 10

Editor's Notes

  1. (c) 2008 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
  2. (c) 2008 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
  3. (c) 2008 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
  4. (c) 2008 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
  5. (c) 2008 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
  6. (c) 2008 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
  7. (c) 2008 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
  8. (c) 2008 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
  9. (c) 2008 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
  10. (c) 2008 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*