Your SlideShare is downloading. ×
0
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Your First ASP_Net project part 1
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Your First ASP_Net project part 1

1,541

Published on

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

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

Published in: Education, Technology
1 Comment
5 Likes
Statistics
Notes
No Downloads
Views
Total Views
1,541
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
6
Comments
1
Likes
5
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Your First ASP.Net Project – Part 1 By: Biswadip Goswami (c) Biswadip Goswami, [email_address]
  • 2. What’s in a page ! <ul><li>Fundamentally an ASP.NET page is just the same as an HTML page. </li></ul><ul><li>Code in an HTML Page: </li></ul><ul><li><html> </li></ul><ul><li><body bgcolor=&quot;yellow&quot;> </li></ul><ul><li><center> </li></ul><ul><li><h2>Hello World!</h2> </li></ul><ul><li></center> </li></ul><ul><li></body> </li></ul><ul><li></html> </li></ul>(c) Biswadip Goswami, biswadip@cognobytes.com
  • 3. <ul><li>Important aspects of developing a ‘Page’ in ASP.Net </li></ul><ul><li>Page structure </li></ul><ul><li>View state </li></ul><ul><li>Namespaces </li></ul><ul><li>Directives </li></ul>(c) Biswadip Goswami, biswadip@cognobytes.com
  • 4. Elements of a Page <ul><li>Directives </li></ul><ul><li>Code declaration blocks </li></ul><ul><li>Code render blocks </li></ul><ul><li>ASP.NET server controls </li></ul><ul><li>Server-side comments </li></ul><ul><li>Server-side include directives </li></ul><ul><li>Literal text and HTML tags </li></ul>(c) Biswadip Goswami, biswadip@cognobytes.com
  • 5. <ul><li>Presentational elements within the page are contained within the <body> tag, while application logic or code can be placed inside <script> tags. </li></ul>(c) Biswadip Goswami, biswadip@cognobytes.com
  • 6. <ul><li>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 %>.  </li></ul><ul><li>The two most important are the Import and Page directives.  </li></ul><ul><li>e.g. <%@ Page Language=&quot;C#&quot; %> </li></ul><ul><li>  The value provided for this attribute, in quotes, specifies that we're using either VB.NET or C#. NET. </li></ul>(c) Biswadip Goswami, biswadip@cognobytes.com
  • 7. <ul><li>Code-behind pages - they let us separate our application logic from an ASP.NET page's HTML presentation code. </li></ul><ul><li>If there is no code behind pages, code declaration blocks  must be used to contain all the application logic of your ASP.NET page. </li></ul><ul><li>We place the code inside  < script >  tags. </li></ul>(c) Biswadip Goswami, biswadip@cognobytes.com
  • 8. <ul><li>Code block in C# : </li></ul><ul><li><script runat=&quot;server&quot;>  void mySub() {   // Code here  }  </script> </li></ul><ul><li>---------------------------------------------------------------- </li></ul><ul><li><script runat=&quot;server&quot; language=&quot;C#&quot;> </li></ul>(c) Biswadip Goswami, biswadip@cognobytes.com
  • 9. <ul><li>Code declaration blocks are generally placed inside the <head>  tag of your ASP.NET page. </li></ul><ul><li>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. </li></ul><ul><li>The second attribute available is src, which lets you specify an external code file to use within your ASP.NET page: </li></ul><ul><li>------------------------------------------------------------------------------- </li></ul><ul><li><script runat=&quot;server&quot; language=&quot;C#&quot; src=&quot;mycodefile.cs&quot;> </li></ul>(c) Biswadip Goswami, biswadip@cognobytes.com
  • 10. <ul><li>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. </li></ul><ul><li>Inline code render blocks execute one or more statements and are placed directly inside a page's HTML within <% and %> characters. </li></ul>(c) Biswadip Goswami, biswadip@cognobytes.com
  • 11. <ul><li>---------------------------------------------------------------- </li></ul><ul><li><% String Title = “My Page&quot;; %>  <%= Title %> </li></ul>(c) Biswadip Goswami, biswadip@cognobytes.com
  • 12. <ul><li>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. </li></ul><ul><li>All ASP.NET controls must reside within a <form runat=&quot;server&quot;> tag in order to function correctly. </li></ul>(c) Biswadip Goswami, biswadip@cognobytes.com
  • 13. (c) Biswadip Goswami, biswadip@cognobytes.com
  • 14. (c) Biswadip Goswami, biswadip@cognobytes.com
  • 15. <ul><li>Server-side comments  allow you to include, within the page, comments or notes that will not be processed by ASP.NET.  </li></ul><ul><li>--------------------------------------------------------------------- </li></ul><ul><li><%--   <button runat=&quot;server&quot; id=&quot;myButton&quot; onServerClick=&quot;Click&quot;>Click Me</button>  <% Title = &quot;New Title&quot; %>  </li></ul><ul><li>--%> </li></ul>(c) Biswadip Goswami, biswadip@cognobytes.com
  • 16. <ul><li>View State </li></ul><ul><li><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> </li></ul>(c) Biswadip Goswami, biswadip@cognobytes.com
  • 17. <ul><li>ASP.NET pages maintain view state by encrypting the data within a hidden form field.  </li></ul><ul><li>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. </li></ul><ul><li>--------------------------------------------------------------------- </li></ul><ul><li><%@ Page EnableViewState=&quot;False&quot; %> </li></ul>(c) Biswadip Goswami, biswadip@cognobytes.com
  • 18. (c) Biswadip Goswami, biswadip@cognobytes.com
  • 19. (c) Biswadip Goswami, biswadip@cognobytes.com
  • 20. (c) Biswadip Goswami, biswadip@cognobytes.com
  • 21. (c) Biswadip Goswami, biswadip@cognobytes.com
  • 22. (c) Biswadip Goswami, biswadip@cognobytes.com
  • 23. (c) Biswadip Goswami, biswadip@cognobytes.com
  • 24. (c) Biswadip Goswami, biswadip@cognobytes.com
  • 25. (c) Biswadip Goswami, biswadip@cognobytes.com
  • 26. (c) Biswadip Goswami, biswadip@cognobytes.com
  • 27. (c) Biswadip Goswami, biswadip@cognobytes.com
  • 28. (c) Biswadip Goswami, biswadip@cognobytes.com
  • 29. (c) Biswadip Goswami, biswadip@cognobytes.com
  • 30. (c) Biswadip Goswami, biswadip@cognobytes.com
  • 31. (c) Biswadip Goswami, biswadip@cognobytes.com
  • 32. (c) Biswadip Goswami, biswadip@cognobytes.com
  • 33. (c) Biswadip Goswami, biswadip@cognobytes.com
  • 34. Thank You ! <ul><li>For assistance with your ASP.Net requirements contact: </li></ul><ul><li>Biswadip Goswami </li></ul><ul><li>Primary e-mail: [email_address] </li></ul><ul><li>Alt e-mail: [email_address] </li></ul><ul><li>Webpage: http://people.cognobytes.com/biswadip </li></ul>(c) Biswadip Goswami, biswadip@cognobytes.com

×