Your First ASP_Net project part 1

25 %
75 %
Information about Your First ASP_Net project part 1
Education

Published on December 23, 2008

Author: biswadip

Source: slideshare.net

Description

This slide show may guide you through various steps to build your first website using ASP.Net technology.

Your First ASP.Net Project – Part 1 By: Biswadip Goswami (c) Biswadip Goswami, [email_address]

What’s in a page ! Fundamentally an ASP.NET page is just the same as an HTML page. Code in an HTML Page: <html> <body bgcolor=&quot;yellow&quot;> <center> <h2>Hello World!</h2> </center> </body> </html> (c) Biswadip Goswami, biswadip@cognobytes.com

Fundamentally an ASP.NET page is just the same as an HTML page.

Code in an HTML Page:

<html>

<body bgcolor=&quot;yellow&quot;>

<center>

<h2>Hello World!</h2>

</center>

</body>

</html>

Important aspects of developing a ‘Page’ in ASP.Net Page structure View state Namespaces Directives (c) Biswadip Goswami, biswadip@cognobytes.com

Important aspects of developing a ‘Page’ in ASP.Net

Page structure

View state

Namespaces

Directives

Elements of a Page Directives Code declaration blocks Code render blocks ASP.NET server controls Server-side comments Server-side include directives Literal text and HTML tags (c) Biswadip Goswami, biswadip@cognobytes.com

Directives

Code declaration blocks

Code render blocks

ASP.NET server controls

Server-side comments

Server-side include directives

Literal text and HTML tags

Presentational elements within the page are contained within the <body> tag, while application logic or code can be placed inside <script> tags. (c) Biswadip Goswami, biswadip@cognobytes.com

Presentational elements within the page are contained within the <body> tag, while application logic or code can be placed inside <script> tags.

Directives control how a page is compiled, specify settings when navigating between pages, aid in debugging (error-fixing), and allow you to import classes to use within your page's code. Directives start with the sequence <%@, followed by the directive name, plus any attributes and their corresponding values, then end with %>.  The two most important are the Import and Page directives.  e.g. <%@ Page Language=&quot;C#&quot; %>   The value provided for this attribute, in quotes, specifies that we're using either VB.NET or C#. NET. (c) Biswadip Goswami, biswadip@cognobytes.com

Directives control how a page is compiled, specify settings when navigating between pages, aid in debugging (error-fixing), and allow you to import classes to use within your page's code. Directives start with the sequence <%@, followed by the directive name, plus any attributes and their corresponding values, then end with %>. 

The two most important are the Import and Page directives. 

e.g. <%@ Page Language=&quot;C#&quot; %>

  The value provided for this attribute, in quotes, specifies that we're using either VB.NET or C#. NET.

Code-behind pages - they let us separate our application logic from an ASP.NET page's HTML presentation code. If there is no code behind pages, code declaration blocks  must be used to contain all the application logic of your ASP.NET page. We place the code inside  < script >  tags. (c) Biswadip Goswami, biswadip@cognobytes.com

Code-behind pages - they let us separate our application logic from an ASP.NET page's HTML presentation code.

If there is no code behind pages, code declaration blocks  must be used to contain all the application logic of your ASP.NET page.

We place the code inside  < script >  tags.

Code block in C# : <script runat=&quot;server&quot;>  void mySub() {   // Code here  }  </script> ---------------------------------------------------------------- <script runat=&quot;server&quot; language=&quot;C#&quot;> (c) Biswadip Goswami, biswadip@cognobytes.com

Code block in C# :

<script runat=&quot;server&quot;>  void mySub() {   // Code here  }  </script>

----------------------------------------------------------------

<script runat=&quot;server&quot; language=&quot;C#&quot;>

Code declaration blocks are generally placed inside the <head>  tag of your ASP.NET page. If we don't specify a language within the code declaration block, the ASP.NET page will use the language provided by the language attribute of the Page directive. The second attribute available is src, which lets you specify an external code file to use within your ASP.NET page: ------------------------------------------------------------------------------- <script runat=&quot;server&quot; language=&quot;C#&quot; src=&quot;mycodefile.cs&quot;> (c) Biswadip Goswami, biswadip@cognobytes.com

Code declaration blocks are generally placed inside the <head>  tag of your ASP.NET page.

If we don't specify a language within the code declaration block, the ASP.NET page will use the language provided by the language attribute of the Page directive.

The second attribute available is src, which lets you specify an external code file to use within your ASP.NET page:

-------------------------------------------------------------------------------

<script runat=&quot;server&quot; language=&quot;C#&quot; src=&quot;mycodefile.cs&quot;>

Code render blocks  is used to define inline code or inline expressions that execute when a page is rendered, and you may recognize these blocks from traditional ASP. Code within a code render block is executed immediately as it is encountered, usually when the page is loaded or rendered for the first time, and every time the page is loaded subsequently. Inline code render blocks execute one or more statements and are placed directly inside a page's HTML within <% and %> characters. (c) Biswadip Goswami, biswadip@cognobytes.com

Code render blocks  is used to define inline code or inline expressions that execute when a page is rendered, and you may recognize these blocks from traditional ASP. Code within a code render block is executed immediately as it is encountered, usually when the page is loaded or rendered for the first time, and every time the page is loaded subsequently.

Inline code render blocks execute one or more statements and are placed directly inside a page's HTML within <% and %> characters.

---------------------------------------------------------------- <% String Title = “My Page&quot;; %>  <%= Title %> (c) Biswadip Goswami, biswadip@cognobytes.com

----------------------------------------------------------------

<% String Title = “My Page&quot;; %>  <%= Title %>

At the heart of ASP.NET pages lies the  server controls , which represent dynamic elements that your users can interact with. There are four basic types of server control: ASP.NET controls, HTML controls, validation controls, and user controls. All ASP.NET controls must reside within a <form runat=&quot;server&quot;> tag in order to function correctly. (c) Biswadip Goswami, biswadip@cognobytes.com

At the heart of ASP.NET pages lies the  server controls , which represent dynamic elements that your users can interact with. There are four basic types of server control: ASP.NET controls, HTML controls, validation controls, and user controls.

All ASP.NET controls must reside within a <form runat=&quot;server&quot;> tag in order to function correctly.

(c) Biswadip Goswami, biswadip@cognobytes.com

(c) Biswadip Goswami, biswadip@cognobytes.com

Server-side comments  allow you to include, within the page, comments or notes that will not be processed by ASP.NET.  --------------------------------------------------------------------- <%--   <button runat=&quot;server&quot; id=&quot;myButton&quot; onServerClick=&quot;Click&quot;>Click Me</button>  <% Title = &quot;New Title&quot; %>  --%> (c) Biswadip Goswami, biswadip@cognobytes.com

Server-side comments  allow you to include, within the page, comments or notes that will not be processed by ASP.NET. 

---------------------------------------------------------------------

<%--   <button runat=&quot;server&quot; id=&quot;myButton&quot; onServerClick=&quot;Click&quot;>Click Me</button>  <% Title = &quot;New Title&quot; %> 

--%>

View State <html>  <head>  <title>Sample Page using C#</title>  <script runat=&quot;server&quot; language=&quot;C#&quot;>  void Click(Object s, EventArgs e) {   lblMessage.Text = txtName.Text;  }  </script>  </head>  <body>  <form runat=&quot;server&quot;>   <asp:TextBox id=&quot;txtName&quot; runat=&quot;server&quot; />   <asp:Button id=&quot;btnSubmit&quot; Text=&quot;Click Me&quot; OnClick=&quot;Click&quot;       runat=&quot;server&quot; />   <asp:Label id=&quot;lblMessage&quot; runat=&quot;server&quot; />  </form>  </body>  </html> (c) Biswadip Goswami, biswadip@cognobytes.com

View State

<html>  <head>  <title>Sample Page using C#</title>  <script runat=&quot;server&quot; language=&quot;C#&quot;>  void Click(Object s, EventArgs e) {   lblMessage.Text = txtName.Text;  }  </script>  </head>  <body>  <form runat=&quot;server&quot;>   <asp:TextBox id=&quot;txtName&quot; runat=&quot;server&quot; />   <asp:Button id=&quot;btnSubmit&quot; Text=&quot;Click Me&quot; OnClick=&quot;Click&quot;       runat=&quot;server&quot; />   <asp:Label id=&quot;lblMessage&quot; runat=&quot;server&quot; />  </form>  </body>  </html>

ASP.NET pages maintain view state by encrypting the data within a hidden form field.  View state is enabled for every page by default. If you do not intend to use view state, you can turn it off, which will result in a slight performance gain in your pages. --------------------------------------------------------------------- <%@ Page EnableViewState=&quot;False&quot; %> (c) Biswadip Goswami, biswadip@cognobytes.com

ASP.NET pages maintain view state by encrypting the data within a hidden form field. 

View state is enabled for every page by default. If you do not intend to use view state, you can turn it off, which will result in a slight performance gain in your pages.

---------------------------------------------------------------------

<%@ Page EnableViewState=&quot;False&quot; %>

(c) Biswadip Goswami, biswadip@cognobytes.com

(c) Biswadip Goswami, biswadip@cognobytes.com

(c) Biswadip Goswami, biswadip@cognobytes.com

(c) Biswadip Goswami, biswadip@cognobytes.com

(c) Biswadip Goswami, biswadip@cognobytes.com

(c) Biswadip Goswami, biswadip@cognobytes.com

(c) Biswadip Goswami, biswadip@cognobytes.com

(c) Biswadip Goswami, biswadip@cognobytes.com

(c) Biswadip Goswami, biswadip@cognobytes.com

(c) Biswadip Goswami, biswadip@cognobytes.com

(c) Biswadip Goswami, biswadip@cognobytes.com

(c) Biswadip Goswami, biswadip@cognobytes.com

(c) Biswadip Goswami, biswadip@cognobytes.com

(c) Biswadip Goswami, biswadip@cognobytes.com

(c) Biswadip Goswami, biswadip@cognobytes.com

(c) Biswadip Goswami, biswadip@cognobytes.com

Thank You ! For assistance with your ASP.Net requirements contact: Biswadip Goswami Primary e-mail: [email_address] Alt e-mail: [email_address] Webpage: http://people.cognobytes.com/biswadip (c) Biswadip Goswami, biswadip@cognobytes.com

For assistance with your ASP.Net requirements contact:

Biswadip Goswami

Primary e-mail: [email_address]

Alt e-mail: [email_address]

Webpage: http://people.cognobytes.com/biswadip

Add a comment

Related presentations

Related pages

Your First ASP_Net project part 1 ppt - eLearning platform ...

Description This slide show may guide you through various steps to build your first website using ASP.Net technology. Type: ppt
Read more

ASP.NET Web API, Part 1: Your First Web API | The ASP.NET Site

ASP.NET Web API, Part 1: Your First Web API; ASP.NET Web API, Part 2: Getting Data; ASP.NET Web API, Part 3: Delete ... to several open source .NET projects.
Read more

Create a website with ASP.Net - Part 1 - YouTube

Want to watch this again later? Sign in to add this video to a playlist. Download this project: https://www.dropbox.com/s/c08osi44c6s... Starter ...
Read more

Creating your first aspnet mvc application - Part 3 - YouTube

... can be found at the link below. http://csharp-video-tutorials.blogspot.com/2013/04/creating-your-first ... project. 1. Right Click on ...
Read more

ASP.NET MVC - Part 1 - CodeProject - For those who code

All of the functionality for ASP.NET MVC projects is ... The first thing this project wizard asks is ... Thank you. Part 2 is here ASP.NET MVC Part 2
Read more

ASP.NET MVC 4 - Part [1] - Introduction - CodeProject

Get started with ASP.NET MVC 4, ... but the article you are trying to view was deleted at 9 Jul 2015. ... Learn ASP.NET in MVC Style: Part 1 ...
Read more

Your First MVC 6 and EF 7 Application (using Empty Project ...

Your First MVC 6 and EF 7 Application (using Empty Project Template) : Part 1
Read more

Walkthrough: Deploying a Web Application Project Using a ...

Walkthrough: Deploying a Web Application Project Using a Web Deployment Package (Part 1 of 4)
Read more

Database First Approach in MVC 5: Part 1 - C# Corner

This article shos the development of an ASP.NET Web application in a MVC 5 project template ... Database First Approach in MVC 5: Part 1. ... you need to ...
Read more