Your SlideShare is downloading. ×
Asp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
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

Asp.Net 2.0 Presentation

12,479

Published on

Published in: Technology
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
12,479
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
851
Comments
0
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. ASP.NET 2.0 Overview
  • 2. Agenda
    • Web development using Visual Studio
    • Page Inheritance model
    • Deployment model
    • Master Pages
    • Themes
    • Miscellaneous
    • Summary
    • Questions
  • 3. Web development using Visual Studio
    • Directory Based Project System Model
      • Edit any web anywhere (no project file required)
      • No longer required to build entire site into a single DLL
      • Can now re-build just individual pages to test and run
    • HTML Source Preservation
      • Tool will never re-format or mangle your code
    • Intellisense Everywhere
      • Code Behind
      • Inline Code
    • Better code separation using folder hierarchies
      • App_Code, App_LocalResources, etc.
  • 4. Page Inheritance model
    • How does ASP.NET 1.1 model works?
      • You have Code Behind file that contains all the control declarations along with code.
      • HTML Markup is contained in the ASPX page.
      • Compilation – ASPX page s compiled into a class that inherits from code behind class.
    • Problems with the above model?
      • Every time a change is made in ASPX page, InitializeComponent section had to be regenerated.
      • Try removing a control from ASPX page, most of the time VS2003 does not cleans up the code.
  • 5. Page Inheritance model contd …
    • ASP.NET 2.0: New code-behind model
      • Works using Partial Classes
      • Uses CodeFile attribute instead of CodeBehind
      • No need to explicit declaration of controls in code behind class.
      • So how does this works?
    • Class for ASPX file generated by ASP.NET
        • namespace ASP
        • {
        • public class default_aspx : MsdnMag.Default
        • {
        • ...
        • }
        • }
  • 6. Page Inheritance model contd …
    • Sibling partial class generated by ASP.NET
      • namespace MsdnMag
      • {
      • public partial class Default : IRequiresSessionState
      • {
      • protected TextBox _nameTextBox;
      • protected Button _enterButton;
      • protected Label _messageLabel;
      • private HtmlForm form1;
      • ...
      • }
      • }
  • 7. Page Inheritance model contd …
    • Codebehind partial class that you write
        • namespace MsdnMag
        • {
        • public partial class Default : Page
        • {
        • void _enterButton_Click(object sender, EventArgs e)
        • {
        • _messageLabel.Text = "Hello there " + _nameTextBox.Text + "!";
        • }
        • }
        • }
  • 8. Deployment Model
    • ASP.NET 2.0 comes up with new deployment modes
      • All Binary
      • All Source
      • Updateable (Source Code in binary and ASPX files in source)
    • All Binary
      • Both Source Code and ASPX are compiled into binary.
      • Each folder is compiled into separate Assembly.
      • The ASPX pages present are just marker files and does NOT contain any code.
      • PrecompiledApp.config – contains version and update mode (as False)
  • 9. Deployment Model Contd…
    • Updateable
      • Source Code is compiled into binary
      • ASPX files remain “as is”.
      • Each folder is compiled into separate Assembly
      • The ASPX pages present contain actual code.
      • PrecompiledApp.config – contains version and update mode (as True)
    • Source Code
      • Source Code deployed “as is”
      • Compiled during first hit and then cached
      • Advantage – any code changes take effect immediately
  • 10. Deployment Model Contd…
    • Command Line: Aspnet_compiler
      • Path: C:WINDOWSMicrosoft.NETFrameworkv2.0.50727
      • Usage: aspnet_compiler.exe -v /web -p "D:
      • ApoorvTutorialASP.NET 2.0Master Pages and Themesweb" c:deploy
    • UI (VS2005): Build -> Publish Web Site
      • Strong Naming possible during publishing.
  • 11. Deployment Model Contd…
    • Assembly Generation and pitfalls
      • Each folder is compiled into separate assembly.
      • E.g. Folder Hierarchy
      • Admin – Admin1.aspx, Admin1.aspx.cs Assembly1
      • - Admin2.aspx, Admin2.aspx.cs
      • Mobile – Mobile1.aspx, Mobile1.aspx.cs Assembly2
      • - Mobile2.aspx, Mobile2.aspx.cs
      • This may cause your site to fail with change in deployment mode.
      • Need to realize that classes are generated at runtime
        • If the Page and the dynamically referenced UserControl (e.g. using LoadControl) are in different page, by default you cannot access the UserControl programmatically.
        • Need to use <%@ Register %> tag on the page to refer to the userControl.
  • 12. Master Pages
    • Visual Inheritance for Web Pages
    • .master file contains template used by all pages in the application.
    • Other pages are contained as controls in the Master page.
    • Content Place Holders
      • Define where custom content will be placed.
      • Can define default content.
      • Can have multiple place holders per page.
    • Design support in Visual Studio .NET 2005.
  • 13. Master Pages contd…
    • <%@ Master %> tag denotes Master page.
    • <asp:contentplaceholder id=&quot;MainContentPlaceHolder&quot; runat=&quot;server&quot;> < / asp:contentplaceholder > tag denotes the place holder for the contents.
    • Content Page
      • Specify the Master page using the “MasterPageFile” attribute in the <%@ Page %> tag.
      • <asp:Content ContentPlaceHolderID=MainContentPlaceHolder ID=mainContent runat=server> CONTENTS < / asp:Content > - contents are placed within above tag.
      • Nesting of master pages is also possible.
  • 14. Themes
    • Personalization of Web Pages
    • Works using .skin files
    • Place .skin file in App_Themes folder
    • Set the Theme property on the page.
      • Can be set using “ Theme ” attribute of <%@ Page %> tag
    • Can set Theme property programmatically as well.
      • Has to be done on or before the Page_PreInit
    • Sample .skin file
      • <asp:Label Runat=&quot;server&quot; ForeColor=&quot;Blue&quot; Font--Names=&quot;Verdana&quot;
      • Font-Size=&quot;Small&quot;/>
  • 15. Miscellaneous Lets look at some more features provided by ASP.NET 2.0
    • Setting default focus
      • Page.SetFocus()
      • Java Script rendered on browser is:
      • <script type=&quot;text/JavaScript&quot;>
      • <!--
      • WebForm_AutoFocus('ctl00_MainContentPlaceHolder_ddlName');// -->
      • </script>
    • Setting default button (for Enter Key)
      • Panel.DefaultButton
      • Designates button to be &quot;clicked&quot; when Enter is pressed with focus in panel
      • <asp:Panel DefaultButton=“Button ID”….
  • 16. Miscellaneous contd…
    • Cross Page Posting
      • Pages can now post back to other pages
      • Relevant properties:
        • control .PostBackUrl - Identifies postback target
        • Page.PreviousPage - Returns reference to page that originated a cross-page postback
        • PreviousPage.IsCrossPagePostBack - Reveals whether a cross-page postback occurred
      • @ PreviousPageType directive provides strongly typed access to previous page
      • Reference previous page control in the new page
  • 17. Miscellaneous contd…
    • E.g.
    • <asp:Button ID=&quot;btnThemes&quot; runat=server Text=&quot;Themes and Skins&quot; PostBackUrl=&quot;~/Personal.aspx&quot;/>
    • Referencing Previous Page’s Controls
      • Using PreviousPage object.
      • PreviousPage.IsCrossPagePostBack
      • Weak Typing
        • PreviousPage .FindControl()
      • Strong Typing
        • <%@ PreviousPageType VirtualPath=&quot;~/Default.aspx&quot; %>
        • PreviousPage .<<Property>>
  • 18. Summary
      • New Page Inheritance Model in ASP.NET 2.0
      • Various Deployment Modes available with .NET 2.0
      • Master Page for consistent UI
      • Web page / site personalization using Themes.
      • Various controls / features available to reduce coding efforts
  • 19. References
      • For Page Inheritance and Deployment Model
        • http://west-wind.com/weblog/posts/3016.aspx
        • http://msdn.microsoft.com/msdnmag/issues/06/01/ExtremeASPNET/
  • 20.
    • Questions

×