=> Asp.net page Structure
--------------------------------------------------------------------------------
Asp.net provide two ways for structuring the code of our ASP.net pages.
1. Inline Code Model
2. Code behind Model
Inline Code Model
---------------------------
The In-line code model is embedded directly with in the asp.net page i.e (.aspx page).
In order to build asp.net page in the inline code model instead of using the code behind model ,
Simply select the "Web form" template from the "add new item " templates window
and make sure that the "Place Code in Separate file " check box option is not selected.
And finally click on Add button to create an asp.net page that uses inline code model.
Once we click add button, an asp.net page will be created with a single file like Default.aspx. And by default this page opened in the source view if the following markup tags structure :-
Note : For the inline code model of an asp.net page ,all business code must be embedded in .aspx page only in the given section i.e <Script runat ="Server">
because in line code model not supported a separate file for business code of the page.
Code Behind Model
-----------------------------------------------------
The code behind model is more preferable model rather than In line code model. And this model provides a separation of user interface and code that allows user to develop and maintains more easily as well as simultaneously users can work on the page as well as on the code.
Once we click add button, an asp.net page will be created with a two file like Default.aspx and Default.aspx.cs. And by default this page opened in the source view if the following markup tags structure :-
+
These are the following options for few Items in an asp.net web development environment that uses code behind model.
1. Web Form
----------------
.aspx file and .aspx.cs or .aspx.vb file
2. Master page
------------------
.master file and .master.cs or .master.vb file
3. Web User Control
-------------------------
.ascx file and .ascx.cs or .ascx.vb file
4. Web service:-
--------------------
.asmx file and .asmx.cs or .asmx.vb file
--------------------------------------------------------------------------------
Asp.net provide two ways for structuring the code of our ASP.net pages.
1. Inline Code Model
2. Code behind Model
Inline Code Model
---------------------------
The In-line code model is embedded directly with in the asp.net page i.e (.aspx page).
In order to build asp.net page in the inline code model instead of using the code behind model ,
Simply select the "Web form" template from the "add new item " templates window
and make sure that the "Place Code in Separate file " check box option is not selected.
And finally click on Add button to create an asp.net page that uses inline code model.
Once we click add button, an asp.net page will be created with a single file like Default.aspx. And by default this page opened in the source view if the following markup tags structure :-
Note : For the inline code model of an asp.net page ,all business code must be embedded in .aspx page only in the given section i.e <Script runat ="Server">
because in line code model not supported a separate file for business code of the page.
Code Behind Model
-----------------------------------------------------
The code behind model is more preferable model rather than In line code model. And this model provides a separation of user interface and code that allows user to develop and maintains more easily as well as simultaneously users can work on the page as well as on the code.
Once we click add button, an asp.net page will be created with a two file like Default.aspx and Default.aspx.cs. And by default this page opened in the source view if the following markup tags structure :-
+
These are the following options for few Items in an asp.net web development environment that uses code behind model.
1. Web Form
----------------
.aspx file and .aspx.cs or .aspx.vb file
2. Master page
------------------
.master file and .master.cs or .master.vb file
3. Web User Control
-------------------------
.ascx file and .ascx.cs or .ascx.vb file
4. Web service:-
--------------------
.asmx file and .asmx.cs or .asmx.vb file