SlideShare a Scribd company logo
ASAP to ASP.NET 2.0 Noam King CTO Sela youniversity
Agenda Introduction Architecture  Master Pages  Personalization  Building a site with Web Parts. Skins and Themes  Administration & Management Site Navigation (Optional) Handling data with ASP.NET 2.0 (Optional) Summary
Introduction to ASP.NET 2.0 Data Controls Login Controls Web Parts Other New Controls Master Pages Themes and Skins Mobility and Localization Compilation Membership Role Management Profiles Configuration Site Maps Health Monitoring Other Services Controls Page Framework Services and APIs
Architecture
Architecture – Code Model   ASP 1.1  ASP 2.0
Architecture – Coding Model (cont.) Reduced Inheritance Complexity No need for declaration code Code is linked by VS2005 and the runtime Reduced Compilation Complexity Code-behind automatically synchronized with aspx page More compilation models
Architecture – Coding Model (cont.) Compilation Normal Similar to Asp 1.1 Batch Compilation Like in asp1.1 <compilation  batch =&quot;true|false&quot;  batchTimeout =&quot;number of seconds&quot;  maxBatchSize =&quot;maximum number of pages per batched compilation&quot;  maxBatchGeneratedFileSize =&quot;maximum combined size (in KB) of the generated source file per batched compilation“ </compilation>
Architecture – Coding Model (cont.) Compilation (cont.) Deployment pre-compilation aspnet_compiler /v /<websitename> –p <source>  HTML pages, resources, configuration files, and ASPX pages are copied separately.  Stub files for the various aspx pages. Increased performance and increased security.
Architecture – Coding Model (cont.) Compilation (cont.) In Place Compliation http:// localhost/mywebsitename/precompile.axd Eliminate performance hit of batch compilation Let you find compilation errors before your users do. Full Runtime Compilation (The Code Directory) the \Code directory is designed for storing class files to be compiled dynamically at run time. Simple deployment
Architecture – Page LifeCycle   Constructor Construct TestDeviceFilter AddParsedSubObject DeterminePostBackMode OnPreInit LoadPersonalizationData InitializeThemes OnInit ApplyControlSkin ApplyPersonalization OnInitComplete LoadPageStateFromPersistenceMedium (PB) LoadControlState (PB) LoadViewState (PB) ProcessPostData1 OnPreLoad OnLoad ProcessPostData2 (PB) RaiseChangedEvents (PB) RaisePostBackEvent (PB) OnLoadComplete OnPreRender OnPreRenderComplete SavePersonalizationData SaveControlState SaveViewState SavePageStateToPersistenceMedium Render OnUnload PB = Post Back
Architecture – Code Page Posting If Page.IsCrossPagePostBack Then Label1.Text = “Hello “ &  PreviousPage.pp_Textbox1.Text  & “<br />” & _ “ Date Selected: “ & _ PreviousPage.pp_Calendar1.Sele ctedDate.ToShortDateString() Else Response.Redirect(“Page1.aspx”) End If
Architecture - Extensibilty New HttpModules SessionID Role Management Anonymous Identification Profile Page Counters New Handlers WebAdminHandler TraceHandler WebResourcesHandler PrecomHandler More…
Architecture – Performance Improved Request Pipeline Up to 30% percent improved request stack Improved Memory management with IIS6 Working set for the worker process reduced by around 50%. General improvements on II6 More to come in the release
Master Pages
Master Pages - Basics Masters define common content and placeholders (<asp:ContentPlaceHolder>) Content pages reference masters and fill placeholders with content (<asp:Content>) <%@ Master %> <asp:ContentPlaceHolder ID=&quot;Main&quot; RunAt=&quot;server&quot; /> <%@ Page MasterPage- File=&quot;Site.master&quot; %> <asp:Content ContentPlaceHolderID= &quot;Main&quot; RunAt=&quot;server&quot; /> </asp:Content> Site.master default.aspx http://.../default.aspx
Master Pages – Defining and applying Defining <%@ Master %> <%@ Page MasterPageFile=&quot;~/Site.master&quot; %> <asp:Content ContentPlaceHolderID=&quot;Main&quot; RunAt=&quot;server&quot;> This content fills the place holder &quot;Main&quot; defined in the master page </asp:Content> Applying
Master Pages Applying to a site <configuration> <system.web> <pages masterPageFile=&quot;~/Site.master&quot; /> </system.web> </configuration> Sub Page_PreInit (ByVal sender As Object,ByVal e As EventArgs) Page.MasterPageFile = &quot;~/Site.master&quot; End Sub Applying Programmatically
Master Pages – Weak Typing (CType(Master.FindControl (&quot;Title&quot;), Label).Text = &quot;Orders&quot; In the content page… <asp:Label ID=&quot;Title&quot; RunAt=&quot;server&quot; /> In the master page…
Master Pages – Strong Typing Master.TitleText = &quot;Orders&quot; In the content page… <asp:Label ID=&quot;Title&quot; RunAt=&quot;server&quot; /> . . . <script language=“VB&quot; runat=&quot;server&quot;> Public Property TitleText as string Get  return Title.Text  End Get Set  Title.Text = value End Set End Property </script> In the master page…
Master Pages - Nesting Master Page IDF (idf.master) Master Page IDF North (idfnorth.master) Master Page IDF South  (idfsouth.master) Content page1 (default.aspx) Content Page2 (default2.aspx) Content Page3 (default3.aspx) Content Page4 (default4.aspx)
Master Pages – Nesting (cont.) Master pages that have masters must contain only Content controls, but Content controls can contain ContentPlaceHolders <!-- Orders.Master --> <%@ Master MasterPageFile=&quot;~/Site.Master&quot; %> <asp:Content ContentPlaceHolderID=&quot;...&quot; RunAt=&quot;server&quot;> <asp:ContentPlaceHolder ID=&quot;...&quot; RunAt=&quot;server&quot;> ... </asp:ContentPlaceHolder> <asp:Content>
Master Pages - Container-Specific <%@ Page Language=”VB” MasterPageFile=”~/Sela.master” Mozilla:MasterPageFile=”~/SelaMozilla.master” Opera:MasterPageFile=”~/SelaOpera.master” %> <asp:Content ID=”Content1” ContentPlaceHolderId=”ContentPlaceHolder1” Runat=”server”> Hello World </asp:Content>
Master Pages – Event order Master page child controls initialization Content page child controls initialization Master page initialization Content page initialization Content page load Master page load Master page child controls loadContent page child controls load
Personalization
Personalization - Overview   Automatic association between the end user viewing the page and any data points stored for that user.  The personalization properties that are maintained on a per-user basis are stored on the server and not on the client.  The end user can access these personalization properties on later site visits. Ideal way to start creating highly customizable and user-specific sites without massing with all the underlined code.
Personalization – Defining & Using <configuration> <system.web> <profile> <properties> <add name=”FirstName” /> <add name=”LastName” /> </properties>   </profile> </system.web> </configuration> Profile.FirstName = TextBox1.Text Configuration Using
Personalization - Groups <group name=”MemberDetails”> <add name=”Member” /> <add name=”DateJoined” /> <add name=”PaidDuesStatus” /> <add name=”Location” /> </group> Label1.Text = Profile.MemberDetails.DateJoined Configuration Using
Personalization - Types Define types to the fields Use default values to the fields Define readonly for fields Create custom types for fields and serialization type. <add name=”Field name” type=”FieldType” serializeAs=”Binary” />
Web Parts
Web Parts Orchestrates operation of Web Parts Maintains list of Web Parts and zones Manages page state (e.g., display mode) and fires events when page state changes Facilitates communication between Web Parts Manages personalization and much more One instance per page; not a visible control. <asp:WebPartManager ID=&quot;WebPartManager1&quot; RunAt=&quot;server&quot; />
Web Parts - WebPartZone Defines zones on a Web Parts page Defines default layout and appearance of Web Parts within each zone <asp:WebPartZone ID=&quot;WeatherZone&quot; DragHighlightColor=&quot;244,198,96&quot;  RunAt=&quot;server&quot; > <PartTitleStyle BackColor=&quot;#2254B1&quot; ForeColor=&quot;White&quot; /> <PartStyle BorderColor=&quot;#81AAF2&quot; BorderStyle=&quot;Solid&quot; BorderWidth=&quot;1px&quot; /> <ZoneTemplate> <!-- Web Parts declared here --> </ZoneTemplate> </asp:WebPartZone>
Web Parts - Controls Controls defined in a WebPartZone Web controls, user controls, custom controls Controls that don't implement IWebPart are internally wrapped in GenericWebParts Adds properties: Title, Description, etc. <ZoneTemplate> <asp:Calendar Title=&quot;Calendar&quot; ID=&quot;Calendar1&quot; RunAt=&quot;server&quot; /> <user:Weather Title=&quot;Weather&quot; ID=&quot;Weather1&quot; RunAt=&quot;server&quot; /> <custom:Search Title=&quot;Search&quot; ID=&quot;Search1&quot; RunAt=&quot;server&quot; /> </ZoneTemplate>
Web Parts – WebPartManager & WebPartPage Menu Gets and sets the page's display mode Value Description BrowserDisplayMode &quot;Normal&quot; display mode; no editing (default) EditDisplayMode Permits editing of Web Parts' appearance and behavior DesignDisplayMode Permits drag-and-drop layout editing CatalogDisplayMode Permits Web Parts to be added to the page ConnectDisplayMode Permits connections to be established between Web parts <asp:WebPartPageMenu ID=”Webpartpagemenu1” Runat=”server”> </asp:WebPartPageMenu>
Web Parts – Catalog Zone <asp:CatalogZone ID=&quot;CatalogZone1&quot; Runat=&quot;server&quot;> <ZoneTemplate> <asp:PageCatalogPart ID=&quot;PageCatalogPart1&quot; Runat=&quot;server&quot; /> <asp:DeclarativeCatalogPart ID=&quot;DeclarativeCatalogPart1&quot; Runat=&quot;server&quot;> <WebPartsTemplate> <!-- Declarative Web Parts go here --> </WebPartsTemplate> </asp:DeclarativeCatalogPart> <asp:ImportCatalogPart ID=&quot;ImportCatalogPart1&quot; Runat=&quot;server&quot; /> </ZoneTemplate> </asp:CatalogZone> DeclarativeCatalogPart
Web Parts - EditorZone <asp:EditorZone ID=&quot;EditorZone1&quot; Runat=&quot;server&quot;> <ZoneTemplate> <asp:AppearanceEditorPart ID=&quot;AppearanceEditorPart1&quot; Runat=&quot;server&quot; /> <asp:BehaviorEditorPart ID=&quot;BehaviorEditorPart1&quot; Runat=&quot;server&quot; /> <asp:LayoutEditorPart ID=&quot;LayoutEditorPart1&quot; Runat=&quot;server&quot; /> </ZoneTemplate> </asp:EditorZone>
Web Parts – Custom Web Parts Any control can serve as a Web Part, but… Controls that derive from WebPart can better leverage the Web Parts infrastructure Control Title and other UI-related properties Control AllowClose, AllowZoneChange, AllowMinimize, and other behavioral properties Apply role-based security (authorization filters) Add custom verbs, export Web Parts, and more
Web Parts – Custom Web Parts (cont.) public class MyWebPart : WebPart { public override WebPartVerbCollection Verbs { get { EnsureChildControls (); WebPartVerb verb = new WebPartVerb (new WebPartEventHandler (OnClearResults)); verb.Text = &quot;Clear Results&quot;; WebPartVerb[] verbs = new WebPartVerb[] { verb }; return new WebPartVerbCollection (base.Verbs, verbs); } } void OnClearResults (object sender, WebPartEventArgs args) { ... } ... }
Skins And Themes
Skins and Themes - Overview Mechanism for theming controls, pages, and sites by group-initializing control properties Skin = Visual attributes for control(s) Physically stored in .skin files Default skins and named skins Theme = Collection of one or more skins Physically stored in Themes subfolders Global themes and local themes
Skins and Themes - Applying <%@ Page Theme=&quot;BasicBlue&quot;> <configuration> <system.web> <pages theme=&quot;BasicBlue&quot; /> </system.web> </configuration> Sub Page_PreInit (ByVal sender As Object, ByVal e As EventArgs) Page.Theme = &quot;BasicBlue&quot; End Sub On a page On a Site Programmatically
Skins And Themes – Global Themes BasicBlue Smoke-AndGlass SKIN SKIN SKIN SKIN ASP.NET-ClientFiles Theme   name = Subdirectory name
Skins and Themes - Local Themes Shocking-Pink Autumn-Leaves SKIN SKIN SKIN SKIN vroot Theme name = Subdirectory name
Skins and Themes – Named Skins Skins without SkinIDs are  default skins Skins with SkinIDs are  named skins SkinIDs must be unique per control type Can be defined in same SKIN file as default skins or in separate files Use controls' SkinID properties to apply named skins
Skins and Thems – Named Skins (Defining and Using) <!-- Default look for DropDownList controls --> <asp:DropDownList runat=&quot;server&quot; BackColor=&quot;blue&quot; ForeColor=&quot;white&quot; SkinID=&quot;Blue&quot; /> <!-- Default look for DataGrid conotrols --> <asp:DataGrid runat=&quot;server&quot; BackColor=&quot;#CCCCCC&quot; BorderWidth=&quot;2pt&quot; BorderStyle=&quot;Solid&quot; BorderColor=&quot;#CCCCCC&quot; GridLines=&quot;Vertical&quot; HorizontalAlign=&quot;Left&quot; SkinID=&quot;Blue&quot;> <HeaderStyle ForeColor=&quot;white&quot; BackColor=&quot;blue&quot; /> <ItemStyle ForeColor=&quot;black&quot; BackColor=&quot;white&quot; /> <AlternatingItemStyle BackColor=&quot;lightblue&quot; ForeColor=&quot;black&quot; /> </asp:DataGrid> ... <asp:DropDownList ID=&quot;Countries&quot; SkinID=&quot;Blue&quot; RunAt=&quot;server&quot; />
Administration & Management
A&M - Overview Administrative tools ASP.NET MMC snap-in Web Site Administration Tool (Webadmin.axd) Configuration API Read/write access to configuration settings Simplified custom configuration sections Instrumentation Perf counters, health monitoring, and more
A&M – ASP.NET MMC Snap-In GUI for applying configuration settings
A&M – Web Site Administration Tool (WAT) Browser-based admin GUI Invoked by requesting Webadmin.axd or using the &quot;ASP.NET Configuration&quot; command in Visual Studio's Website menu
A&M – Configuration class Gateway to the configuration API Provides merged view of configuration settings for machine or application AppSettings and ConnectionStrings properties provide access to <appSettings> and <connectionStrings> sections Sections and SectionGroups properties provide access to all other sections
A&M – Configuration Class Methods   Name Description GetExeConfiguration Returns a Configuration object representing config settings for a managed EXE GetMachineConfiguration Returns a Configuration object representing configuration settings for the specified server GetWebConfiguration Returns a Configuration object representing configuration settings for the specified Web application GetSectionGroup Returns a ConfigurationSectionGroup object representing the specified section group Update Records changes in the relevant configuration file GetSection Returns a ConfigurationSection object representing the specified section (e.g., <appSettings>
A&M – Configuration class properties Name Description AppSettings Returns an AppSettingsSection object representing the <appSettings> section ConnectionStrings Returns a ConnectionStringsSection object representing the <connectionsStrings> section HasFile True if there's a corresponding configuration file, false if not SectionGroups Returns a ConfigurationSectionGroupCollection representing all section groups Sections Returns a ConfigurationSectionCollection representing all sections Path Path to the app represented by this Configuration object
A&M – Configuration example (Reading Connection String) ‘ Read a connection string from <connectionStrings> Dim connect As string = ConfigurationSettings.ConnectionStrings(&quot;Northwind“).ConnectionString ‘ Add a connection string to <connectionStrings> Dim config As Configuration = Configuration.GetWebConfiguration (Request.ApplicationPath) config.ConnectionStrings.ConnectionStrings.Add (new ConnectionStringSettings (&quot;Northwind&quot;, &quot;server=localhost;database=northwind;integrated security=true&quot;) config.Update () // Important!
A&M – ASP.NET Instrumentation Name Description Performance   counters New peformance counters supplement the ones introduced in ASP.NET 1.x Windows event tracing Integration with ETW subsystem to support low-overhead tracing of HTTP requests through the system Application tracing ASP.NET trace facility upgraded with new features and to allow coupling to System.Diagnostics.Trace Health monitoring New provider-based subsystem for logging notable events (&quot;Web events&quot;) that occur during an application's lifetime
Handling Data
Handling Data – DataSource control SqlDataSource Enables you to work with any SQL-based database, such as Microsoft SQL Server or Oracle. AccessDataSource Enables you to work with a Microsoft Access file (.mbd). ObjectDataSource Enables you to work with a business object or a Visual Studio 2005 data component. XmlDataSource Enables you to work with the information from an XML file or an XML source (for example an RSS feed). SiteMapDataSource  Enables you to work with the hierarchical data represented in the site map file (.sitemap).  DataSetDataSource   Enables you to work with data that is represented in a DataSet object .
Handling Data – Data Bound Server controls <asp:GridView> <asp:DataGrid> <asp:DetailsView> <asp:TreeView> <asp:Menu> <asp:DataList> <asp:Repeater> <asp:DropDownList> <asp:BulletedList> <asp:CheckBoxList> <asp:RadioButtonList> <asp:ListBox> <asp:AdRotator>
Site Navigation
Site Navigation - Overview Navigation UIs are tedious to implement Especially if they rely on client-side script New controls simplify site navigation TreeView and Menu - Navigation UI SiteMapDataSource - XML site maps SiteMapPath - &quot;Bread crumb&quot; controls Public API provides foundation for controls Provider-based for flexibility
Site Navigation - Schema Site Navigation API Site Maps Web.sitemap Other Data Stores Controls Menu TreeView SiteMapPath SiteMap- DataSource SiteMap SiteMapNode SiteMapNode SiteMapNode XmlSiteMapProvider Other Site Map Providers Providers
Site Navigation – TreeView Example <asp:TreeView ShowLines=&quot;true&quot; Font-Name=&quot;Verdana&quot; Font-Size=&quot;10pt&quot; ... > <SelectedNodeStyle BackColor=&quot;Yellow&quot; /> <HoverNodeStyle BackColor=&quot;LightBlue&quot; /> <Nodes> <asp:TreeNode Text=&quot;Not selectable&quot; SelectAction=&quot;None&quot; RunAt=&quot;server&quot;> <asp:TreeNode Text=&quot;Selectable&quot; SelectAction=&quot;Select&quot; RunAt=&quot;server&quot; > <asp:TreeNode Text=&quot;Click to expand or collapse&quot; SelectAction=&quot;Expand&quot; Runat=&quot;server&quot;> <asp:TreeNode Text=&quot;Click to select and expand or collapse&quot; SelectAction=&quot;SelectExpand&quot; Runat=&quot;server&quot;> <asp:TreeNode Text=&quot;Check box node&quot; ShowCheckBox=&quot;true&quot; Runat=&quot;server&quot;> <asp:TreeNode Text=&quot;Click to navigate&quot; NavigateUrl=&quot;...&quot; Runat=&quot;server&quot; /> </asp:TreeNode> </asp:TreeNode> </asp:TreeNode> </asp:TreeNode> </asp:TreeNode> </Nodes> </asp:TreeView>
Site Navigation – Menu Control <asp:Menu Orientation=&quot;Horizontal&quot; RunAt=&quot;server&quot;> <Items> <asp:MenuItem Text=&quot;Training&quot; RunAt=&quot;server&quot;> <asp:MenuItem Text=&quot;Programming .NET&quot; RunAt=&quot;server&quot; Navigateurl=&quot;Classes.aspx?id=1&quot; /> <asp:MenuItem Text=&quot;Programming ASP.NET&quot; RunAt=&quot;server&quot; NavigateUrl=&quot;Classes.aspx?id=2&quot; /> <asp:MenuItem Text=&quot;Programming Web Services&quot; RunAt=&quot;server&quot; NavigateUrl=&quot;Classes.aspx?id=3&quot; /> </asp:MenuItem> <asp:MenuItem Text=&quot;Consulting&quot; RunAt=&quot;server&quot; NavigateUrl=&quot;Consulting.aspx&quot; /> <asp:MenuItem Text=&quot;Debugging&quot; RunAt=&quot;server&quot; NavigateUrl=&quot;Debugging.aspx&quot; /> </Items> </asp:Menu>
Site Navagation - SiteMap <siteMap> <siteMapNode title=&quot;Home&quot; description=&quot;&quot; url=&quot;default.aspx&quot;> <siteMapNode title=&quot;Training&quot; url=&quot;Training.aspx&quot; description=&quot;Training for .NET developers&quot;> <siteMapNode title=&quot;Programming .NET&quot; url=&quot;Classes.aspx?id=1&quot; description=&quot;All about the .NET Framework&quot; /> <siteMapNode title=&quot;Programming ASP.NET&quot; url=&quot;Classes.aspx?id=2&quot; description=&quot;All about ASP.NET&quot; /> <siteMapNode title=&quot;Programming Web Services&quot; url=&quot;Classes.aspx?id=3&quot; description=&quot;All about Web services&quot; /> </siteMapNode> <siteMapNode title=&quot;Consulting&quot; url=&quot;Consulting.aspx&quot; description=&quot;Consulting for .NET projects&quot; /> <siteMapNode title=&quot;Debugging&quot; url=&quot;Debugging.aspx&quot; description=&quot;Help when you need it the most&quot; /> </siteMapNode> </siteMap>
Site Navigation – TreeView and SiteMap <siteMap> <siteMapNode title=&quot;Home&quot; description=&quot;&quot; url=&quot;default.aspx&quot;> <siteMapNode title=&quot;Training&quot; url=&quot;Training.aspx&quot; description=&quot;Training for .NET developers&quot;> <siteMapNode title=&quot;Programming .NET&quot; url=&quot;Classes.aspx?id=1&quot; description=&quot;All about the .NET Framework&quot; /> <siteMapNode title=&quot;Programming ASP.NET&quot; url=&quot;Classes.aspx?id=2&quot; description=&quot;All about ASP.NET&quot; /> <siteMapNode title=&quot;Programming Web Services&quot; url=&quot;Classes.aspx?id=3&quot; description=&quot;All about Web services&quot; /> </siteMapNode> <siteMapNode title=&quot;Consulting&quot; url=&quot;Consulting.aspx&quot; description=&quot;Consulting for .NET projects&quot; /> <siteMapNode title=&quot;Debugging&quot; url=&quot;Debugging.aspx&quot; description=&quot;Help when you need it the most&quot; /> </siteMapNode> </siteMap> Web.sitemap <asp:SiteMapDataSource ID=&quot;SiteMap&quot; RunAt=&quot;server&quot; /> <asp:TreeView DataSourceID=&quot;SiteMap&quot; RunAt=&quot;server&quot; />
Site Navigation – Menu and SiteMap <asp:SiteMapDataSource ID=&quot;SiteMap&quot; RunAt=&quot;server&quot; /> <asp:Menu DataSourceID=&quot;SiteMap&quot; RunAt=&quot;server&quot; /> <siteMap> <siteMapNode title=&quot;Home&quot; description=&quot;&quot; url=&quot;default.aspx&quot;> <siteMapNode title=&quot;Training&quot; url=&quot;Training.aspx&quot; description=&quot;Training for .NET developers&quot;> <siteMapNode title=&quot;Programming .NET&quot; url=&quot;Classes.aspx?id=1&quot; description=&quot;All about the .NET Framework&quot; /> <siteMapNode title=&quot;Programming ASP.NET&quot; url=&quot;Classes.aspx?id=2&quot; description=&quot;All about ASP.NET&quot; /> <siteMapNode title=&quot;Programming Web Services&quot; url=&quot;Classes.aspx?id=3&quot; description=&quot;All about Web services&quot; /> </siteMapNode> <siteMapNode title=&quot;Consulting&quot; url=&quot;Consulting.aspx&quot; description=&quot;Consulting for .NET projects&quot; /> <siteMapNode title=&quot;Debugging&quot; url=&quot;Debugging.aspx&quot; description=&quot;Help when you need it the most&quot; /> </siteMapNode> </siteMap> Web.sitemap
Site Navigation – SiteMap API Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Hyperlink1.Text = SiteMap.CurrentNode.ParentNode.ToString() Hyperlink1.NavigateUrl = SiteMap.CurrentNode.ParentNode.Url Hyperlink2.Text = SiteMap.CurrentNode.PreviousSibling.ToString() Hyperlink2.NavigateUrl = SiteMap.CurrentNode.PreviousSibling.Url Hyperlink3.Text = SiteMap.CurrentNode.NextSibling.ToString() Hyperlink3.NavigateUrl = SiteMap.CurrentNode.NextSibling.Url End Sub <html xmlns=”http://www.w3.org/1999/xhtml” > <head runat=”server”> <title>SiteMapDataSource</title> </head> <body> <form id=”form1” runat=”server”> Move Up: <asp:Hyperlink ID=”Hyperlink1” Runat=”server”></asp:Hyperlink><br /> <-- <asp:Hyperlink ID=”Hyperlink2” Runat=”server”></asp:Hyperlink> | <asp:Hyperlink ID=”Hyperlink3” Runat=”server”></asp:Hyperlink> --> </form> </body> </html>
Summary – ASAP.Net New features to simplify repetitive coding tasks New provider model offers extra extensibility New compilation model fixes old base/derived class problem It’s stronger, faster, prettier and with a better engine. Wouldn’t you like to give it a test drive ?

More Related Content

ODP
Introduction of Html/css/js
PPTX
Master page and Theme ASP.NET with VB.NET
PPTX
ASP.NET with VB.NET
PPTX
PDF
Introduction to CSS3
PPTX
Introducing CSS Grid
PPTX
CSS Flexbox (flexible box layout)
PDF
WordPress Theme Development
Introduction of Html/css/js
Master page and Theme ASP.NET with VB.NET
ASP.NET with VB.NET
Introduction to CSS3
Introducing CSS Grid
CSS Flexbox (flexible box layout)
WordPress Theme Development

What's hot (20)

PPTX
An Overview of HTML, CSS & Java Script
PDF
Introduction to CSS Grid Layout
PPTX
Css font properties
PPTX
Bootstrap ppt
PDF
CSS selectors
PPTX
Cascading Style Sheet (CSS)
PDF
Le Wagon - 2h Landing
PPTX
HTML CSS and Web Development
PDF
CSS Best practice
PDF
CSS Day: CSS Grid Layout
PDF
PDF
Web technology lab manual
PPSX
Introduction to Html5
PPTX
Html coding
PDF
Style and Selector
PDF
Lab#5 style and selector
PPTX
presentation in html,css,javascript
ODP
An Overview of HTML, CSS & Java Script
Introduction to CSS Grid Layout
Css font properties
Bootstrap ppt
CSS selectors
Cascading Style Sheet (CSS)
Le Wagon - 2h Landing
HTML CSS and Web Development
CSS Best practice
CSS Day: CSS Grid Layout
Web technology lab manual
Introduction to Html5
Html coding
Style and Selector
Lab#5 style and selector
presentation in html,css,javascript
Ad

Viewers also liked (7)

DOC
SLAUGHTERHOUSE
PPTX
Information Technology Report
PDF
Tateiju EspañA GuíA Del Inmigrante Segundo Numero
PPTX
Quickpoint How To
DOCX
Quickword How To
PDF
Arts Education And Creativity.Pcah Reinvesting 4web
DOCX
رواية 4
SLAUGHTERHOUSE
Information Technology Report
Tateiju EspañA GuíA Del Inmigrante Segundo Numero
Quickpoint How To
Quickword How To
Arts Education And Creativity.Pcah Reinvesting 4web
رواية 4
Ad

Similar to Aspnet2 Overview (20)

PPS
Asp.Net 2.0 Presentation
PPTX
Master pages ppt
PPTX
Master Pages In Asp.net
PPTX
Parallelminds.web partdemo1
PPT
ASP.NET 06 - Customizing Your Sites Appearance
PPT
Asp.net
PPTX
Introduction to ASP.NET
PPS
11 asp.net session16
PPTX
Introduction to asp.net
DOC
.NET 1.1 Base Page Framework Article
PPTX
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
PPT
Csphtp1 20
PPT
Asp.net architecture
PPTX
Vs2010 Aspnet MSP Bootcamp_MVP Ngan Seok Chern
PPTX
Master page in Asp.net
PPTX
Master page
PPT
How to develop asp web applications
PPTX
masterpages 1.pptx
PPT
Developing an ASP.NET Web Application
PDF
Inside WSS sample shots
Asp.Net 2.0 Presentation
Master pages ppt
Master Pages In Asp.net
Parallelminds.web partdemo1
ASP.NET 06 - Customizing Your Sites Appearance
Asp.net
Introduction to ASP.NET
11 asp.net session16
Introduction to asp.net
.NET 1.1 Base Page Framework Article
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
Csphtp1 20
Asp.net architecture
Vs2010 Aspnet MSP Bootcamp_MVP Ngan Seok Chern
Master page in Asp.net
Master page
How to develop asp web applications
masterpages 1.pptx
Developing an ASP.NET Web Application
Inside WSS sample shots

Recently uploaded (20)

PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Spectroscopy.pptx food analysis technology
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Cloud computing and distributed systems.
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Electronic commerce courselecture one. Pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
KodekX | Application Modernization Development
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Mobile App Security Testing_ A Comprehensive Guide.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
sap open course for s4hana steps from ECC to s4
Reach Out and Touch Someone: Haptics and Empathic Computing
Spectroscopy.pptx food analysis technology
NewMind AI Weekly Chronicles - August'25 Week I
Cloud computing and distributed systems.
The AUB Centre for AI in Media Proposal.docx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Building Integrated photovoltaic BIPV_UPV.pdf
Unlocking AI with Model Context Protocol (MCP)
Encapsulation_ Review paper, used for researhc scholars
Digital-Transformation-Roadmap-for-Companies.pptx
Electronic commerce courselecture one. Pdf
Understanding_Digital_Forensics_Presentation.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
KodekX | Application Modernization Development
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...

Aspnet2 Overview

  • 1. ASAP to ASP.NET 2.0 Noam King CTO Sela youniversity
  • 2. Agenda Introduction Architecture Master Pages Personalization Building a site with Web Parts. Skins and Themes Administration & Management Site Navigation (Optional) Handling data with ASP.NET 2.0 (Optional) Summary
  • 3. Introduction to ASP.NET 2.0 Data Controls Login Controls Web Parts Other New Controls Master Pages Themes and Skins Mobility and Localization Compilation Membership Role Management Profiles Configuration Site Maps Health Monitoring Other Services Controls Page Framework Services and APIs
  • 5. Architecture – Code Model ASP 1.1 ASP 2.0
  • 6. Architecture – Coding Model (cont.) Reduced Inheritance Complexity No need for declaration code Code is linked by VS2005 and the runtime Reduced Compilation Complexity Code-behind automatically synchronized with aspx page More compilation models
  • 7. Architecture – Coding Model (cont.) Compilation Normal Similar to Asp 1.1 Batch Compilation Like in asp1.1 <compilation batch =&quot;true|false&quot; batchTimeout =&quot;number of seconds&quot; maxBatchSize =&quot;maximum number of pages per batched compilation&quot; maxBatchGeneratedFileSize =&quot;maximum combined size (in KB) of the generated source file per batched compilation“ </compilation>
  • 8. Architecture – Coding Model (cont.) Compilation (cont.) Deployment pre-compilation aspnet_compiler /v /<websitename> –p <source> HTML pages, resources, configuration files, and ASPX pages are copied separately. Stub files for the various aspx pages. Increased performance and increased security.
  • 9. Architecture – Coding Model (cont.) Compilation (cont.) In Place Compliation http:// localhost/mywebsitename/precompile.axd Eliminate performance hit of batch compilation Let you find compilation errors before your users do. Full Runtime Compilation (The Code Directory) the \Code directory is designed for storing class files to be compiled dynamically at run time. Simple deployment
  • 10. Architecture – Page LifeCycle Constructor Construct TestDeviceFilter AddParsedSubObject DeterminePostBackMode OnPreInit LoadPersonalizationData InitializeThemes OnInit ApplyControlSkin ApplyPersonalization OnInitComplete LoadPageStateFromPersistenceMedium (PB) LoadControlState (PB) LoadViewState (PB) ProcessPostData1 OnPreLoad OnLoad ProcessPostData2 (PB) RaiseChangedEvents (PB) RaisePostBackEvent (PB) OnLoadComplete OnPreRender OnPreRenderComplete SavePersonalizationData SaveControlState SaveViewState SavePageStateToPersistenceMedium Render OnUnload PB = Post Back
  • 11. Architecture – Code Page Posting If Page.IsCrossPagePostBack Then Label1.Text = “Hello “ & PreviousPage.pp_Textbox1.Text & “<br />” & _ “ Date Selected: “ & _ PreviousPage.pp_Calendar1.Sele ctedDate.ToShortDateString() Else Response.Redirect(“Page1.aspx”) End If
  • 12. Architecture - Extensibilty New HttpModules SessionID Role Management Anonymous Identification Profile Page Counters New Handlers WebAdminHandler TraceHandler WebResourcesHandler PrecomHandler More…
  • 13. Architecture – Performance Improved Request Pipeline Up to 30% percent improved request stack Improved Memory management with IIS6 Working set for the worker process reduced by around 50%. General improvements on II6 More to come in the release
  • 15. Master Pages - Basics Masters define common content and placeholders (<asp:ContentPlaceHolder>) Content pages reference masters and fill placeholders with content (<asp:Content>) <%@ Master %> <asp:ContentPlaceHolder ID=&quot;Main&quot; RunAt=&quot;server&quot; /> <%@ Page MasterPage- File=&quot;Site.master&quot; %> <asp:Content ContentPlaceHolderID= &quot;Main&quot; RunAt=&quot;server&quot; /> </asp:Content> Site.master default.aspx http://.../default.aspx
  • 16. Master Pages – Defining and applying Defining <%@ Master %> <%@ Page MasterPageFile=&quot;~/Site.master&quot; %> <asp:Content ContentPlaceHolderID=&quot;Main&quot; RunAt=&quot;server&quot;> This content fills the place holder &quot;Main&quot; defined in the master page </asp:Content> Applying
  • 17. Master Pages Applying to a site <configuration> <system.web> <pages masterPageFile=&quot;~/Site.master&quot; /> </system.web> </configuration> Sub Page_PreInit (ByVal sender As Object,ByVal e As EventArgs) Page.MasterPageFile = &quot;~/Site.master&quot; End Sub Applying Programmatically
  • 18. Master Pages – Weak Typing (CType(Master.FindControl (&quot;Title&quot;), Label).Text = &quot;Orders&quot; In the content page… <asp:Label ID=&quot;Title&quot; RunAt=&quot;server&quot; /> In the master page…
  • 19. Master Pages – Strong Typing Master.TitleText = &quot;Orders&quot; In the content page… <asp:Label ID=&quot;Title&quot; RunAt=&quot;server&quot; /> . . . <script language=“VB&quot; runat=&quot;server&quot;> Public Property TitleText as string Get return Title.Text End Get Set Title.Text = value End Set End Property </script> In the master page…
  • 20. Master Pages - Nesting Master Page IDF (idf.master) Master Page IDF North (idfnorth.master) Master Page IDF South (idfsouth.master) Content page1 (default.aspx) Content Page2 (default2.aspx) Content Page3 (default3.aspx) Content Page4 (default4.aspx)
  • 21. Master Pages – Nesting (cont.) Master pages that have masters must contain only Content controls, but Content controls can contain ContentPlaceHolders <!-- Orders.Master --> <%@ Master MasterPageFile=&quot;~/Site.Master&quot; %> <asp:Content ContentPlaceHolderID=&quot;...&quot; RunAt=&quot;server&quot;> <asp:ContentPlaceHolder ID=&quot;...&quot; RunAt=&quot;server&quot;> ... </asp:ContentPlaceHolder> <asp:Content>
  • 22. Master Pages - Container-Specific <%@ Page Language=”VB” MasterPageFile=”~/Sela.master” Mozilla:MasterPageFile=”~/SelaMozilla.master” Opera:MasterPageFile=”~/SelaOpera.master” %> <asp:Content ID=”Content1” ContentPlaceHolderId=”ContentPlaceHolder1” Runat=”server”> Hello World </asp:Content>
  • 23. Master Pages – Event order Master page child controls initialization Content page child controls initialization Master page initialization Content page initialization Content page load Master page load Master page child controls loadContent page child controls load
  • 25. Personalization - Overview Automatic association between the end user viewing the page and any data points stored for that user. The personalization properties that are maintained on a per-user basis are stored on the server and not on the client. The end user can access these personalization properties on later site visits. Ideal way to start creating highly customizable and user-specific sites without massing with all the underlined code.
  • 26. Personalization – Defining & Using <configuration> <system.web> <profile> <properties> <add name=”FirstName” /> <add name=”LastName” /> </properties> </profile> </system.web> </configuration> Profile.FirstName = TextBox1.Text Configuration Using
  • 27. Personalization - Groups <group name=”MemberDetails”> <add name=”Member” /> <add name=”DateJoined” /> <add name=”PaidDuesStatus” /> <add name=”Location” /> </group> Label1.Text = Profile.MemberDetails.DateJoined Configuration Using
  • 28. Personalization - Types Define types to the fields Use default values to the fields Define readonly for fields Create custom types for fields and serialization type. <add name=”Field name” type=”FieldType” serializeAs=”Binary” />
  • 30. Web Parts Orchestrates operation of Web Parts Maintains list of Web Parts and zones Manages page state (e.g., display mode) and fires events when page state changes Facilitates communication between Web Parts Manages personalization and much more One instance per page; not a visible control. <asp:WebPartManager ID=&quot;WebPartManager1&quot; RunAt=&quot;server&quot; />
  • 31. Web Parts - WebPartZone Defines zones on a Web Parts page Defines default layout and appearance of Web Parts within each zone <asp:WebPartZone ID=&quot;WeatherZone&quot; DragHighlightColor=&quot;244,198,96&quot; RunAt=&quot;server&quot; > <PartTitleStyle BackColor=&quot;#2254B1&quot; ForeColor=&quot;White&quot; /> <PartStyle BorderColor=&quot;#81AAF2&quot; BorderStyle=&quot;Solid&quot; BorderWidth=&quot;1px&quot; /> <ZoneTemplate> <!-- Web Parts declared here --> </ZoneTemplate> </asp:WebPartZone>
  • 32. Web Parts - Controls Controls defined in a WebPartZone Web controls, user controls, custom controls Controls that don't implement IWebPart are internally wrapped in GenericWebParts Adds properties: Title, Description, etc. <ZoneTemplate> <asp:Calendar Title=&quot;Calendar&quot; ID=&quot;Calendar1&quot; RunAt=&quot;server&quot; /> <user:Weather Title=&quot;Weather&quot; ID=&quot;Weather1&quot; RunAt=&quot;server&quot; /> <custom:Search Title=&quot;Search&quot; ID=&quot;Search1&quot; RunAt=&quot;server&quot; /> </ZoneTemplate>
  • 33. Web Parts – WebPartManager & WebPartPage Menu Gets and sets the page's display mode Value Description BrowserDisplayMode &quot;Normal&quot; display mode; no editing (default) EditDisplayMode Permits editing of Web Parts' appearance and behavior DesignDisplayMode Permits drag-and-drop layout editing CatalogDisplayMode Permits Web Parts to be added to the page ConnectDisplayMode Permits connections to be established between Web parts <asp:WebPartPageMenu ID=”Webpartpagemenu1” Runat=”server”> </asp:WebPartPageMenu>
  • 34. Web Parts – Catalog Zone <asp:CatalogZone ID=&quot;CatalogZone1&quot; Runat=&quot;server&quot;> <ZoneTemplate> <asp:PageCatalogPart ID=&quot;PageCatalogPart1&quot; Runat=&quot;server&quot; /> <asp:DeclarativeCatalogPart ID=&quot;DeclarativeCatalogPart1&quot; Runat=&quot;server&quot;> <WebPartsTemplate> <!-- Declarative Web Parts go here --> </WebPartsTemplate> </asp:DeclarativeCatalogPart> <asp:ImportCatalogPart ID=&quot;ImportCatalogPart1&quot; Runat=&quot;server&quot; /> </ZoneTemplate> </asp:CatalogZone> DeclarativeCatalogPart
  • 35. Web Parts - EditorZone <asp:EditorZone ID=&quot;EditorZone1&quot; Runat=&quot;server&quot;> <ZoneTemplate> <asp:AppearanceEditorPart ID=&quot;AppearanceEditorPart1&quot; Runat=&quot;server&quot; /> <asp:BehaviorEditorPart ID=&quot;BehaviorEditorPart1&quot; Runat=&quot;server&quot; /> <asp:LayoutEditorPart ID=&quot;LayoutEditorPart1&quot; Runat=&quot;server&quot; /> </ZoneTemplate> </asp:EditorZone>
  • 36. Web Parts – Custom Web Parts Any control can serve as a Web Part, but… Controls that derive from WebPart can better leverage the Web Parts infrastructure Control Title and other UI-related properties Control AllowClose, AllowZoneChange, AllowMinimize, and other behavioral properties Apply role-based security (authorization filters) Add custom verbs, export Web Parts, and more
  • 37. Web Parts – Custom Web Parts (cont.) public class MyWebPart : WebPart { public override WebPartVerbCollection Verbs { get { EnsureChildControls (); WebPartVerb verb = new WebPartVerb (new WebPartEventHandler (OnClearResults)); verb.Text = &quot;Clear Results&quot;; WebPartVerb[] verbs = new WebPartVerb[] { verb }; return new WebPartVerbCollection (base.Verbs, verbs); } } void OnClearResults (object sender, WebPartEventArgs args) { ... } ... }
  • 39. Skins and Themes - Overview Mechanism for theming controls, pages, and sites by group-initializing control properties Skin = Visual attributes for control(s) Physically stored in .skin files Default skins and named skins Theme = Collection of one or more skins Physically stored in Themes subfolders Global themes and local themes
  • 40. Skins and Themes - Applying <%@ Page Theme=&quot;BasicBlue&quot;> <configuration> <system.web> <pages theme=&quot;BasicBlue&quot; /> </system.web> </configuration> Sub Page_PreInit (ByVal sender As Object, ByVal e As EventArgs) Page.Theme = &quot;BasicBlue&quot; End Sub On a page On a Site Programmatically
  • 41. Skins And Themes – Global Themes BasicBlue Smoke-AndGlass SKIN SKIN SKIN SKIN ASP.NET-ClientFiles Theme name = Subdirectory name
  • 42. Skins and Themes - Local Themes Shocking-Pink Autumn-Leaves SKIN SKIN SKIN SKIN vroot Theme name = Subdirectory name
  • 43. Skins and Themes – Named Skins Skins without SkinIDs are default skins Skins with SkinIDs are named skins SkinIDs must be unique per control type Can be defined in same SKIN file as default skins or in separate files Use controls' SkinID properties to apply named skins
  • 44. Skins and Thems – Named Skins (Defining and Using) <!-- Default look for DropDownList controls --> <asp:DropDownList runat=&quot;server&quot; BackColor=&quot;blue&quot; ForeColor=&quot;white&quot; SkinID=&quot;Blue&quot; /> <!-- Default look for DataGrid conotrols --> <asp:DataGrid runat=&quot;server&quot; BackColor=&quot;#CCCCCC&quot; BorderWidth=&quot;2pt&quot; BorderStyle=&quot;Solid&quot; BorderColor=&quot;#CCCCCC&quot; GridLines=&quot;Vertical&quot; HorizontalAlign=&quot;Left&quot; SkinID=&quot;Blue&quot;> <HeaderStyle ForeColor=&quot;white&quot; BackColor=&quot;blue&quot; /> <ItemStyle ForeColor=&quot;black&quot; BackColor=&quot;white&quot; /> <AlternatingItemStyle BackColor=&quot;lightblue&quot; ForeColor=&quot;black&quot; /> </asp:DataGrid> ... <asp:DropDownList ID=&quot;Countries&quot; SkinID=&quot;Blue&quot; RunAt=&quot;server&quot; />
  • 46. A&M - Overview Administrative tools ASP.NET MMC snap-in Web Site Administration Tool (Webadmin.axd) Configuration API Read/write access to configuration settings Simplified custom configuration sections Instrumentation Perf counters, health monitoring, and more
  • 47. A&M – ASP.NET MMC Snap-In GUI for applying configuration settings
  • 48. A&M – Web Site Administration Tool (WAT) Browser-based admin GUI Invoked by requesting Webadmin.axd or using the &quot;ASP.NET Configuration&quot; command in Visual Studio's Website menu
  • 49. A&M – Configuration class Gateway to the configuration API Provides merged view of configuration settings for machine or application AppSettings and ConnectionStrings properties provide access to <appSettings> and <connectionStrings> sections Sections and SectionGroups properties provide access to all other sections
  • 50. A&M – Configuration Class Methods Name Description GetExeConfiguration Returns a Configuration object representing config settings for a managed EXE GetMachineConfiguration Returns a Configuration object representing configuration settings for the specified server GetWebConfiguration Returns a Configuration object representing configuration settings for the specified Web application GetSectionGroup Returns a ConfigurationSectionGroup object representing the specified section group Update Records changes in the relevant configuration file GetSection Returns a ConfigurationSection object representing the specified section (e.g., <appSettings>
  • 51. A&M – Configuration class properties Name Description AppSettings Returns an AppSettingsSection object representing the <appSettings> section ConnectionStrings Returns a ConnectionStringsSection object representing the <connectionsStrings> section HasFile True if there's a corresponding configuration file, false if not SectionGroups Returns a ConfigurationSectionGroupCollection representing all section groups Sections Returns a ConfigurationSectionCollection representing all sections Path Path to the app represented by this Configuration object
  • 52. A&M – Configuration example (Reading Connection String) ‘ Read a connection string from <connectionStrings> Dim connect As string = ConfigurationSettings.ConnectionStrings(&quot;Northwind“).ConnectionString ‘ Add a connection string to <connectionStrings> Dim config As Configuration = Configuration.GetWebConfiguration (Request.ApplicationPath) config.ConnectionStrings.ConnectionStrings.Add (new ConnectionStringSettings (&quot;Northwind&quot;, &quot;server=localhost;database=northwind;integrated security=true&quot;) config.Update () // Important!
  • 53. A&M – ASP.NET Instrumentation Name Description Performance counters New peformance counters supplement the ones introduced in ASP.NET 1.x Windows event tracing Integration with ETW subsystem to support low-overhead tracing of HTTP requests through the system Application tracing ASP.NET trace facility upgraded with new features and to allow coupling to System.Diagnostics.Trace Health monitoring New provider-based subsystem for logging notable events (&quot;Web events&quot;) that occur during an application's lifetime
  • 55. Handling Data – DataSource control SqlDataSource Enables you to work with any SQL-based database, such as Microsoft SQL Server or Oracle. AccessDataSource Enables you to work with a Microsoft Access file (.mbd). ObjectDataSource Enables you to work with a business object or a Visual Studio 2005 data component. XmlDataSource Enables you to work with the information from an XML file or an XML source (for example an RSS feed). SiteMapDataSource Enables you to work with the hierarchical data represented in the site map file (.sitemap). DataSetDataSource Enables you to work with data that is represented in a DataSet object .
  • 56. Handling Data – Data Bound Server controls <asp:GridView> <asp:DataGrid> <asp:DetailsView> <asp:TreeView> <asp:Menu> <asp:DataList> <asp:Repeater> <asp:DropDownList> <asp:BulletedList> <asp:CheckBoxList> <asp:RadioButtonList> <asp:ListBox> <asp:AdRotator>
  • 58. Site Navigation - Overview Navigation UIs are tedious to implement Especially if they rely on client-side script New controls simplify site navigation TreeView and Menu - Navigation UI SiteMapDataSource - XML site maps SiteMapPath - &quot;Bread crumb&quot; controls Public API provides foundation for controls Provider-based for flexibility
  • 59. Site Navigation - Schema Site Navigation API Site Maps Web.sitemap Other Data Stores Controls Menu TreeView SiteMapPath SiteMap- DataSource SiteMap SiteMapNode SiteMapNode SiteMapNode XmlSiteMapProvider Other Site Map Providers Providers
  • 60. Site Navigation – TreeView Example <asp:TreeView ShowLines=&quot;true&quot; Font-Name=&quot;Verdana&quot; Font-Size=&quot;10pt&quot; ... > <SelectedNodeStyle BackColor=&quot;Yellow&quot; /> <HoverNodeStyle BackColor=&quot;LightBlue&quot; /> <Nodes> <asp:TreeNode Text=&quot;Not selectable&quot; SelectAction=&quot;None&quot; RunAt=&quot;server&quot;> <asp:TreeNode Text=&quot;Selectable&quot; SelectAction=&quot;Select&quot; RunAt=&quot;server&quot; > <asp:TreeNode Text=&quot;Click to expand or collapse&quot; SelectAction=&quot;Expand&quot; Runat=&quot;server&quot;> <asp:TreeNode Text=&quot;Click to select and expand or collapse&quot; SelectAction=&quot;SelectExpand&quot; Runat=&quot;server&quot;> <asp:TreeNode Text=&quot;Check box node&quot; ShowCheckBox=&quot;true&quot; Runat=&quot;server&quot;> <asp:TreeNode Text=&quot;Click to navigate&quot; NavigateUrl=&quot;...&quot; Runat=&quot;server&quot; /> </asp:TreeNode> </asp:TreeNode> </asp:TreeNode> </asp:TreeNode> </asp:TreeNode> </Nodes> </asp:TreeView>
  • 61. Site Navigation – Menu Control <asp:Menu Orientation=&quot;Horizontal&quot; RunAt=&quot;server&quot;> <Items> <asp:MenuItem Text=&quot;Training&quot; RunAt=&quot;server&quot;> <asp:MenuItem Text=&quot;Programming .NET&quot; RunAt=&quot;server&quot; Navigateurl=&quot;Classes.aspx?id=1&quot; /> <asp:MenuItem Text=&quot;Programming ASP.NET&quot; RunAt=&quot;server&quot; NavigateUrl=&quot;Classes.aspx?id=2&quot; /> <asp:MenuItem Text=&quot;Programming Web Services&quot; RunAt=&quot;server&quot; NavigateUrl=&quot;Classes.aspx?id=3&quot; /> </asp:MenuItem> <asp:MenuItem Text=&quot;Consulting&quot; RunAt=&quot;server&quot; NavigateUrl=&quot;Consulting.aspx&quot; /> <asp:MenuItem Text=&quot;Debugging&quot; RunAt=&quot;server&quot; NavigateUrl=&quot;Debugging.aspx&quot; /> </Items> </asp:Menu>
  • 62. Site Navagation - SiteMap <siteMap> <siteMapNode title=&quot;Home&quot; description=&quot;&quot; url=&quot;default.aspx&quot;> <siteMapNode title=&quot;Training&quot; url=&quot;Training.aspx&quot; description=&quot;Training for .NET developers&quot;> <siteMapNode title=&quot;Programming .NET&quot; url=&quot;Classes.aspx?id=1&quot; description=&quot;All about the .NET Framework&quot; /> <siteMapNode title=&quot;Programming ASP.NET&quot; url=&quot;Classes.aspx?id=2&quot; description=&quot;All about ASP.NET&quot; /> <siteMapNode title=&quot;Programming Web Services&quot; url=&quot;Classes.aspx?id=3&quot; description=&quot;All about Web services&quot; /> </siteMapNode> <siteMapNode title=&quot;Consulting&quot; url=&quot;Consulting.aspx&quot; description=&quot;Consulting for .NET projects&quot; /> <siteMapNode title=&quot;Debugging&quot; url=&quot;Debugging.aspx&quot; description=&quot;Help when you need it the most&quot; /> </siteMapNode> </siteMap>
  • 63. Site Navigation – TreeView and SiteMap <siteMap> <siteMapNode title=&quot;Home&quot; description=&quot;&quot; url=&quot;default.aspx&quot;> <siteMapNode title=&quot;Training&quot; url=&quot;Training.aspx&quot; description=&quot;Training for .NET developers&quot;> <siteMapNode title=&quot;Programming .NET&quot; url=&quot;Classes.aspx?id=1&quot; description=&quot;All about the .NET Framework&quot; /> <siteMapNode title=&quot;Programming ASP.NET&quot; url=&quot;Classes.aspx?id=2&quot; description=&quot;All about ASP.NET&quot; /> <siteMapNode title=&quot;Programming Web Services&quot; url=&quot;Classes.aspx?id=3&quot; description=&quot;All about Web services&quot; /> </siteMapNode> <siteMapNode title=&quot;Consulting&quot; url=&quot;Consulting.aspx&quot; description=&quot;Consulting for .NET projects&quot; /> <siteMapNode title=&quot;Debugging&quot; url=&quot;Debugging.aspx&quot; description=&quot;Help when you need it the most&quot; /> </siteMapNode> </siteMap> Web.sitemap <asp:SiteMapDataSource ID=&quot;SiteMap&quot; RunAt=&quot;server&quot; /> <asp:TreeView DataSourceID=&quot;SiteMap&quot; RunAt=&quot;server&quot; />
  • 64. Site Navigation – Menu and SiteMap <asp:SiteMapDataSource ID=&quot;SiteMap&quot; RunAt=&quot;server&quot; /> <asp:Menu DataSourceID=&quot;SiteMap&quot; RunAt=&quot;server&quot; /> <siteMap> <siteMapNode title=&quot;Home&quot; description=&quot;&quot; url=&quot;default.aspx&quot;> <siteMapNode title=&quot;Training&quot; url=&quot;Training.aspx&quot; description=&quot;Training for .NET developers&quot;> <siteMapNode title=&quot;Programming .NET&quot; url=&quot;Classes.aspx?id=1&quot; description=&quot;All about the .NET Framework&quot; /> <siteMapNode title=&quot;Programming ASP.NET&quot; url=&quot;Classes.aspx?id=2&quot; description=&quot;All about ASP.NET&quot; /> <siteMapNode title=&quot;Programming Web Services&quot; url=&quot;Classes.aspx?id=3&quot; description=&quot;All about Web services&quot; /> </siteMapNode> <siteMapNode title=&quot;Consulting&quot; url=&quot;Consulting.aspx&quot; description=&quot;Consulting for .NET projects&quot; /> <siteMapNode title=&quot;Debugging&quot; url=&quot;Debugging.aspx&quot; description=&quot;Help when you need it the most&quot; /> </siteMapNode> </siteMap> Web.sitemap
  • 65. Site Navigation – SiteMap API Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Hyperlink1.Text = SiteMap.CurrentNode.ParentNode.ToString() Hyperlink1.NavigateUrl = SiteMap.CurrentNode.ParentNode.Url Hyperlink2.Text = SiteMap.CurrentNode.PreviousSibling.ToString() Hyperlink2.NavigateUrl = SiteMap.CurrentNode.PreviousSibling.Url Hyperlink3.Text = SiteMap.CurrentNode.NextSibling.ToString() Hyperlink3.NavigateUrl = SiteMap.CurrentNode.NextSibling.Url End Sub <html xmlns=”http://www.w3.org/1999/xhtml” > <head runat=”server”> <title>SiteMapDataSource</title> </head> <body> <form id=”form1” runat=”server”> Move Up: <asp:Hyperlink ID=”Hyperlink1” Runat=”server”></asp:Hyperlink><br /> <-- <asp:Hyperlink ID=”Hyperlink2” Runat=”server”></asp:Hyperlink> | <asp:Hyperlink ID=”Hyperlink3” Runat=”server”></asp:Hyperlink> --> </form> </body> </html>
  • 66. Summary – ASAP.Net New features to simplify repetitive coding tasks New provider model offers extra extensibility New compilation model fixes old base/derived class problem It’s stronger, faster, prettier and with a better engine. Wouldn’t you like to give it a test drive ?