Top Banner
2002-2005 Deep Training/Litwin Consulting, Inc. All Rights Reserved Worldwide. Unauthorized duplication is strictly prohibited. Page 1 ASP.NET 2.0 and Visual ASP.NET 2.0 and Visual Studio 2005 Overview Studio 2005 Overview Paul Litwin Paul Litwin Collaborative Data Services, Collaborative Data Services, Public Health Sciences, Public Health Sciences, Fred Hutchinson Cancer Research Center Fred Hutchinson Cancer Research Center cds.fhcrc.org cds.fhcrc.org [email protected] [email protected] 2 © 2002-2005 Deep Training/Litwin Consulting, Inc. New Features at a Glance New Features at a Glance 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 3 © 2002-2005 Deep Training/Litwin Consulting, Inc. IDE Changes IDE Changes
22

Asp.net.2.0 beta2 overview

Dec 17, 2014

Download

Education

sktech2010

 
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Asp.net.2.0 beta2 overview

2002-2005 Deep Training/Litwin Consulting, Inc. All Rights Reserved Worldwide. Unauthorized duplication is strictly prohibited.

Page 1

ASP.NET 2.0 and Visual ASP.NET 2.0 and Visual Studio 2005 OverviewStudio 2005 Overview

Paul LitwinPaul LitwinCollaborative Data Services,Collaborative Data Services,Public Health Sciences,Public Health Sciences,Fred Hutchinson Cancer Research CenterFred Hutchinson Cancer Research [email protected]@fhcrc.org

2© 2002-2005 Deep Training/Litwin Consulting, Inc.

New Features at a GlanceNew Features at a Glance

DataControls

LoginControls

Web Parts Other NewControls

Master Pages Themesand Skins

Mobility andLocalization

Compilation

MembershipRole

Management Profiles Configuration

SiteMaps

HealthMonitoring

OtherServices

Cont

rols

Page

Fram

ewor

kSe

rvic

esan

d AP

Is

3© 2002-2005 Deep Training/Litwin Consulting, Inc.

IDE ChangesIDE Changes

Page 2: Asp.net.2.0 beta2 overview

2002-2005 Deep Training/Litwin Consulting, Inc. All Rights Reserved Worldwide. Unauthorized duplication is strictly prohibited.

Page 2

4© 2002-2005 Deep Training/Litwin Consulting, Inc.

Getting Started with VS 2005Getting Started with VS 2005

uu No need to create a projectNo need to create a projectuu Instead create a new Web SiteInstead create a new Web Site

uu Web sites can beWeb sites can befilefile--system basedsystem based

5© 2002-2005 Deep Training/Litwin Consulting, Inc.

VS 2005 Highlights (1 of 6)VS 2005 Highlights (1 of 6)

uu Editor doesnEditor doesn’’t reformat HTML unless you t reformat HTML unless you ask it to!ask it to!

uu Selection preserved when switching Selection preserved when switching between Design and Source (HTML) between Design and Source (HTML) viewsviews

uu Can now validate HTML against Can now validate HTML against additional browsers and XHTMLadditional browsers and XHTML

uu Edit and Continue is reborn!Edit and Continue is reborn!

6© 2002-2005 Deep Training/Litwin Consulting, Inc.

VS 2005 Highlights (2 of 6)VS 2005 Highlights (2 of 6)

uu CodeCode--behind and inline code are equal behind and inline code are equal citizenscitizensll Full support for IntelliSense for both stylesFull support for IntelliSense for both stylesll Choose your style in Add New Item dialogChoose your style in Add New Item dialog

uu Source changes tracked in marginSource changes tracked in marginll Unsaved changes in yellowUnsaved changes in yellowll Recently saved changes in greenRecently saved changes in green

Page 3: Asp.net.2.0 beta2 overview

2002-2005 Deep Training/Litwin Consulting, Inc. All Rights Reserved Worldwide. Unauthorized duplication is strictly prohibited.

Page 3

7© 2002-2005 Deep Training/Litwin Consulting, Inc.

VS 2005 Highlights (3 of 6)VS 2005 Highlights (3 of 6)

uu IntelliSense works everywhereIntelliSense works everywherell HTMLHTMLll CodeCodell Page directivesPage directivesll Web.configWeb.configll Design viewDesign viewnn Technically these are smart tagsTechnically these are smart tags

8© 2002-2005 Deep Training/Litwin Consulting, Inc.

VS 2005 Highlights (4 of 6)VS 2005 Highlights (4 of 6)

uu Speaking of Config FilesSpeaking of Config Filesll Three ways to edit settingsThree ways to edit settings

1.1. Use IntelliSense within web.config fileUse IntelliSense within web.config file2.2. Select ASP.NET tab inside of IIS Admin Select ASP.NET tab inside of IIS Admin

application, click Edit Configuration btnapplication, click Edit Configuration btnnn Extensive control of web.config settingsExtensive control of web.config settings

3.3. Select Website | ASP.NET ConfigurationSelect Website | ASP.NET Configurationnn Not as complete as IIS Admin toolNot as complete as IIS Admin toolnn Includes Security Setup wizardIncludes Security Setup wizard

nn Works with nonWorks with non--IIS sitesIIS sites

9© 2002-2005 Deep Training/Litwin Consulting, Inc.

VS 2005 Highlights (5 of 6)VS 2005 Highlights (5 of 6)

uu Creating event handlers now consistent Creating event handlers now consistent across languages (VB or C#)across languages (VB or C#)ll Can do it from property sheet Can do it from property sheet

for both languagesfor both languages

uu Moving windows easierMoving windows easierll Thanks to window guidesThanks to window guides

uu Toolbox categorizes controlsToolbox categorizes controls

Page 4: Asp.net.2.0 beta2 overview

2002-2005 Deep Training/Litwin Consulting, Inc. All Rights Reserved Worldwide. Unauthorized duplication is strictly prohibited.

Page 4

10© 2002-2005 Deep Training/Litwin Consulting, Inc.

VS 2005 Highlights (6 of 6)VS 2005 Highlights (6 of 6)uu VS ships with personal Web serverVS ships with personal Web server

ll No need to create a virtual rootNo need to create a virtual rootll Next version of Cassini Web serverNext version of Cassini Web server

uu Lots of ways to connect to a siteLots of ways to connect to a site

11© 2002-2005 Deep Training/Litwin Consulting, Inc.

And Did I MentionAnd Did I Mention……uu Express EditionsExpress Editions

ll lowlow--cost entry point for enthusiast/hobbyist/partcost entry point for enthusiast/hobbyist/part--time devtime dev

uu Team SystemTeam Systemll An expanded version of VS that speaks to the An expanded version of VS that speaks to the

whole design/development/testing lifewhole design/development/testing life--cyclecyclenn client/server, collaboration basedclient/server, collaboration basednn robust/scalable source controlrobust/scalable source controlnn work item (e.g., bugs) trackingwork item (e.g., bugs) trackingnn unit testing, load testingunit testing, load testingnn code analysiscode analysisnn project portalproject portalnn lots morelots more……

12© 2002-2005 Deep Training/Litwin Consulting, Inc.

Expanding Visual StudioExpanding Visual Studio

EvaluateEvaluate.NET.NET

Interact withInteract withstudentsstudents

Build coolBuild coolappsapps

Learn howLearn howto programto program

HobbyistsHobbyists

StudentsStudents FacultyFaculty

EnthusiastsEnthusiasts

Page 5: Asp.net.2.0 beta2 overview

2002-2005 Deep Training/Litwin Consulting, Inc. All Rights Reserved Worldwide. Unauthorized duplication is strictly prohibited.

Page 5

13© 2002-2005 Deep Training/Litwin Consulting, Inc.

Expanding Visual StudioExpanding Visual Studio

ProjectManager

ApplicationArchitect

Developer Tester

InfrastructureArchitect

Team Foundation ServerTeam Foundation Server

Users &Management

Web Browser

Team Explorer

VSTE/STVSTE/SD

VSTE/SA

WorkWorkItemsItems

BuildBuildServerServer

SourceSourceControlControl

ProjectProjectPortalPortal

ReportingReporting& Analytics& Analytics

14© 2002-2005 Deep Training/Litwin Consulting, Inc.

Visual Studio 2005Visual Studio 2005““Personalized productivityPersonalized productivity””

Enthusiasts

Students

Hobbyists

Part-Timers

Professionals

Consultants

Enterprise Devs

Architects

Testers

VB6 Devs

15© 2002-2005 Deep Training/Litwin Consulting, Inc.

Data ControlsData Controls

Page 6: Asp.net.2.0 beta2 overview

2002-2005 Deep Training/Litwin Consulting, Inc. All Rights Reserved Worldwide. Unauthorized duplication is strictly prohibited.

Page 6

16© 2002-2005 Deep Training/Litwin Consulting, Inc.

Binding Data to ControlsBinding Data to Controls

uu ASP.NET 1.x supported rich 1ASP.NET 1.x supported rich 1--way way binding syntax but you still had to write binding syntax but you still had to write quite a bit of code to get data in and out quite a bit of code to get data in and out of controlsof controls

uu ASP.NET 2.0 supports twoASP.NET 2.0 supports two--way way (read/write) binding with no code in (read/write) binding with no code in many situationsmany situations

17© 2002-2005 Deep Training/Litwin Consulting, Inc.

Data Source ControlData Source Control

uu A family of controls that assist in data A family of controls that assist in data bindingbindingll Middleman between data bound controls Middleman between data bound controls

and data sourcesand data sources

uu Types of Data Source ControlsTypes of Data Source Controlsll TabularTabularnn SqlDataSourceSqlDataSourcenn AccessDataSourceAccessDataSourcenn ObjectDataSourceObjectDataSource

ll HierarchicalHierarchicalnn XmlDataSourceXmlDataSourcenn SiteMapDataSourceSiteMapDataSource

18© 2002-2005 Deep Training/Litwin Consulting, Inc.

New 2.0 DataNew 2.0 Data--Bound ControlsBound Controls

uu List ControlsList Controlsll BulletedListBulletedList

uu Composite ControlsComposite Controlsll GridViewGridViewll DetailsViewDetailsViewll FormViewFormView

uu Hierarchical ControlsHierarchical Controlsll TreeViewTreeViewll MenuMenu

Page 7: Asp.net.2.0 beta2 overview

2002-2005 Deep Training/Litwin Consulting, Inc. All Rights Reserved Worldwide. Unauthorized duplication is strictly prohibited.

Page 7

19© 2002-2005 Deep Training/Litwin Consulting, Inc.

GridView ControlGridView ControlExample: Example: GridView.aspxGridView.aspxuu A A ““codecode--lessless”” DataGridDataGriduu WalkWalk--through of grid with automatic through of grid with automatic

sorting (ascending & descending), sorting (ascending & descending), paginationpagination1.1. Add Add GridViewGridView to pageto page2.2. Using Using GridViewGridView Tasks pane, choose Tasks pane, choose

DataSourceDataSource3.3. Check Check EnablePagingEnablePaging & & EnableSortingEnableSorting

20© 2002-2005 Deep Training/Litwin Consulting, Inc.

GridView with UpdatingGridView with UpdatingExample: GridViewUpdate1.aspxExample: GridViewUpdate1.aspxuu Can also be done without codeCan also be done without code

1.1. Add Add GridViewGridView to pageto page2.2. Choose Data SourceChoose Data Source

ll On "Configure the select statement" pageOn "Configure the select statement" page

ll Click Advanced OptionsClick Advanced Optionsll Check Check ““Generate Insert, Update, and Delete Generate Insert, Update, and Delete

statementsstatements””

3.3. Configure GridViewConfigure GridViewll Check Check ““Enable EditingEnable Editing”” and/or Enable Deletingand/or Enable Deleting

21© 2002-2005 Deep Training/Litwin Consulting, Inc.

The SingleThe Single--Record Form ProblemRecord Form Problem

uu ASP.NET 1.x provided no help to the ASP.NET 1.x provided no help to the developer having to create a singledeveloper having to create a single--record record ““formform”” view of dataview of data

uu ASP.NET 2.0 gives us two solutionsASP.NET 2.0 gives us two solutionsll DetailsView DetailsView –– fixed look (supports styles but no fixed look (supports styles but no

field templates); can't get at individual fieldsfield templates); can't get at individual fields

ll FormView FormView –– fully templated (VS will generate basic fully templated (VS will generate basic template for you); will work with validation controlstemplate for you); will work with validation controls

uu Both support editing, paginationBoth support editing, pagination

Page 8: Asp.net.2.0 beta2 overview

2002-2005 Deep Training/Litwin Consulting, Inc. All Rights Reserved Worldwide. Unauthorized duplication is strictly prohibited.

Page 8

22© 2002-2005 Deep Training/Litwin Consulting, Inc.

FormViewFormView vs. vs. DetailsViewDetailsViewControlsControls

23© 2002-2005 Deep Training/Litwin Consulting, Inc.

Master Pages and NavigationMaster Pages and Navigation

24© 2002-2005 Deep Training/Litwin Consulting, Inc.

NavigationNavigationuu Three PiecesThree Pieces

1.1. Navigation SiteMapNavigation SiteMapnn Web.sitemap XML fileWeb.sitemap XML file

nn Allows you to create a sitemap for navigation Allows you to create a sitemap for navigation purposespurposes

2.2. SiteMapDataSourceSiteMapDataSourcenn Reads Web.sitemap file and makes available Reads Web.sitemap file and makes available

to TreeView controlto TreeView control

3.3. ControlsControlsnn TreeView TreeView –– displays navigation treedisplays navigation tree

nn Menu Menu –– displays flyout menusdisplays flyout menusnn SiteMapPath SiteMapPath –– "breadcrumb" path"breadcrumb" path

Page 9: Asp.net.2.0 beta2 overview

2002-2005 Deep Training/Litwin Consulting, Inc. All Rights Reserved Worldwide. Unauthorized duplication is strictly prohibited.

Page 9

25© 2002-2005 Deep Training/Litwin Consulting, Inc.

Master PagesMaster Pages

uu Major shortcoming of ASP.NET 1.x: Major shortcoming of ASP.NET 1.x: lack lack of any easy way to create page of any easy way to create page templates that other pages can inherittemplates that other pages can inherit

uu Enter ASP.NET 2.0 Master PagesEnter ASP.NET 2.0 Master Pagesll Easy and powerful way to create a common Easy and powerful way to create a common

layout for all (or a subset of) pages in sitelayout for all (or a subset of) pages in sitell Support for multiple levels of master pagesSupport for multiple levels of master pagesll WYSIWYG support for master pages in WYSIWYG support for master pages in

Visual StudioVisual Studio

26© 2002-2005 Deep Training/Litwin Consulting, Inc.

Mastering Master PagesMastering Master Pages

uu Arrange content on master page Arrange content on master page (.master extension)(.master extension)ll Add placeholders for content pages using Add placeholders for content pages using

the ContentPlaceHolder elementthe ContentPlaceHolder element

uu Create pages based on master pageCreate pages based on master pagell Use Use MasterPageFileMasterPageFile attribute in page attribute in page

directivedirectivell Add content to Content elementAdd content to Content element

27© 2002-2005 Deep Training/Litwin Consulting, Inc.

Master Pages DemoMaster Pages Demo

Page 10: Asp.net.2.0 beta2 overview

2002-2005 Deep Training/Litwin Consulting, Inc. All Rights Reserved Worldwide. Unauthorized duplication is strictly prohibited.

Page 10

28© 2002-2005 Deep Training/Litwin Consulting, Inc.

Login Controls and Security Login Controls and Security

29© 2002-2005 Deep Training/Litwin Consulting, Inc.

New Security Parts (1 of 2)New Security Parts (1 of 2)uu Forms AuthenticationForms Authentication

ll Cookieless authentication now supportedCookieless authentication now supported

uu Login ControlsLogin Controlsll UI controls for managing login of usersUI controls for managing login of users

uu MembershipMembershipll Standardized solution for storing forms Standardized solution for storing forms

authentication dataauthentication datall Membership.ValidateUser methodMembership.ValidateUser methodll Login controls wrap up membership serviceLogin controls wrap up membership servicell ProviderProvider--basedbased

30© 2002-2005 Deep Training/Litwin Consulting, Inc.

New Security Parts (2 of 2)New Security Parts (2 of 2)uu Role ManagementRole Management

ll Simplifies authorization code you have to Simplifies authorization code you have to writewrite

ll ProviderProvider--basedbased

uu PersonalizationPersonalizationll Simplifies storing of site personalization Simplifies storing of site personalization

data in user profilesdata in user profilesll Support for stronglySupport for strongly--typed profile propertiestyped profile propertiesll ProviderProvider--basedbased

Page 11: Asp.net.2.0 beta2 overview

2002-2005 Deep Training/Litwin Consulting, Inc. All Rights Reserved Worldwide. Unauthorized duplication is strictly prohibited.

Page 11

31© 2002-2005 Deep Training/Litwin Consulting, Inc.

New Features at a GlanceNew Features at a Glance

DataControls

LoginControls

Web Parts Other NewControls

Master Pages Themesand Skins

Mobility andLocalization

Compilation

MembershipRole

Management Profiles Configuration

SiteMaps

HealthMonitoring

OtherServices

Cont

rols

Page

Fram

ewor

kSe

rvic

esan

d AP

Is

32© 2002-2005 Deep Training/Litwin Consulting, Inc.

Forms AuthenticationForms Authentication<authentication mode="Forms">

<forms name="name" cookieless=UseCookie|UseUri|AutoDetect|

UseDeviceProfiledefaultUrl=[URL] domain=domain nameloginUrl="url" protection="All|None|Encryption|Validation"timeout="30" path="/"requireSSL="true|false"slidingExpiration="true|false">

</forms></authentication>

33© 2002-2005 Deep Training/Litwin Consulting, Inc.

Using Security Setup WizardUsing Security Setup Wizard

uu Walks you through Walks you through setting up setting up authentication, authentication, membership membership provider, users, and provider, users, and role management role management for Web sitefor Web site

uu Can setup Forms or Can setup Forms or Windows authWindows auth

uu Start wizard from Start wizard from Web Site Admin Web Site Admin Tool (Tool (Website | Website | ASP.NET ConfigurationASP.NET Configuration) )

Page 12: Asp.net.2.0 beta2 overview

2002-2005 Deep Training/Litwin Consulting, Inc. All Rights Reserved Worldwide. Unauthorized duplication is strictly prohibited.

Page 12

34© 2002-2005 Deep Training/Litwin Consulting, Inc.

Login ControlsLogin Controlsuu Login Login –– log in users (goes on login page)log in users (goes on login page)uu LoginView LoginView –– displays different views displays different views

based on whether user is authenticatedbased on whether user is authenticateduu PasswordRecovery PasswordRecovery –– recover or reset recover or reset

lost passwordlost passworduu LoginStatus LoginStatus –– displays login or logout displays login or logout

linklinkuu LoginName LoginName –– displays login name for displays login name for

authenticated usersauthenticated usersuu CreateUserWizard CreateUserWizard –– steps user through steps user through

wizard to create new accountwizard to create new accountuu ChangePassword ChangePassword –– changes password changes password

for userfor user

35© 2002-2005 Deep Training/Litwin Consulting, Inc.

Login Controls DemoLogin Controls Demo

36© 2002-2005 Deep Training/Litwin Consulting, Inc.

Membership ServiceMembership Serviceuu Saves you from having to manage users and Saves you from having to manage users and

passwordspasswordsuu Login controls may obviate need to directly work with Login controls may obviate need to directly work with

the classes in many casesthe classes in many cases

uu Choice of providers (SQL Server, Access, etc.)Choice of providers (SQL Server, Access, etc.)uu Example UsesExample Uses

ll Authenticate UserAuthenticate Usernn Membership.ValidateUser()Membership.ValidateUser()

ll Find User by Email addressFind User by Email addressnn Membership.FindUsersByEmail()Membership.FindUsersByEmail()

ll Estimate number of users onlineEstimate number of users onlinenn Membership.GetNumberOfUsersOnline()Membership.GetNumberOfUsersOnline()

Page 13: Asp.net.2.0 beta2 overview

2002-2005 Deep Training/Litwin Consulting, Inc. All Rights Reserved Worldwide. Unauthorized duplication is strictly prohibited.

Page 13

37© 2002-2005 Deep Training/Litwin Consulting, Inc.

Role ServiceRole Serviceuu Simplifies authorization using rolesSimplifies authorization using rolesuu Manage roles at design time using ASP.NET Manage roles at design time using ASP.NET

Web Admin toolWeb Admin toolll Or use Roles and RoleProvider classes at runtimeOr use Roles and RoleProvider classes at runtime

uu Use LoginView control to display custom Use LoginView control to display custom content per rolecontent per rolell Order RoleGroup elements from highest to lowest Order RoleGroup elements from highest to lowest

precedence (e.g., Admin first, etc.)precedence (e.g., Admin first, etc.)

uu Or use User.IsInRole() method from codeOr use User.IsInRole() method from code

38© 2002-2005 Deep Training/Litwin Consulting, Inc.

Role ServiceRole Serviceuu Role data carried between pages by ASP.NET Role data carried between pages by ASP.NET

using encrypted cookiesusing encrypted cookiesuu Reduces roundReduces round--trips to database for role trips to database for role

informationinformation

39© 2002-2005 Deep Training/Litwin Consulting, Inc.

LoginView Roles ExampleLoginView Roles ExampleLoginView.aspxLoginView.aspx

<asp:LoginView ID="lvRoles" Runat="server"><RoleGroups>

<asp:RoleGroup Roles="Admins"><ContentTemplate>This message prints for members of the Admins group.</ContentTemplate></asp:RoleGroup><asp:RoleGroup Roles="Managers"><ContentTemplate>This message prints for members of the Managers group.</ContentTemplate></asp:RoleGroup><asp:RoleGroup Roles="Users"><ContentTemplate>This message prints for members of the Users group.</ContentTemplate></asp:RoleGroup>

</RoleGroups></asp:LoginView>

Page 14: Asp.net.2.0 beta2 overview

2002-2005 Deep Training/Litwin Consulting, Inc. All Rights Reserved Worldwide. Unauthorized duplication is strictly prohibited.

Page 14

40© 2002-2005 Deep Training/Litwin Consulting, Inc.

IsInRole Roles ExampleIsInRole Roles ExampleRoles.aspx.csRoles.aspx.cs

protected void Page_Load(…){// Order by highest to lowestif (User.IsInRole("Developers"))

lblRole.Text = "Developer. You rule!";else if (User.IsInRole("Managers"))

lblRole.Text = "Manager. So?";else if (User.IsInRole("Users"))

lblRole.Text = "Lowly user";else

lblRole.Text = "Not logged in.";}

41© 2002-2005 Deep Training/Litwin Consulting, Inc.

Personalization ServicePersonalization Service

uu No need to create fields in a database to No need to create fields in a database to keep track of personalization datakeep track of personalization data

uu Allows you to strongly type your Allows you to strongly type your personalization datapersonalization data

uu You maintain personalization data in You maintain personalization data in user profilesuser profiles

42© 2002-2005 Deep Training/Litwin Consulting, Inc.

Creating a ProfileCreating a Profile

<profile defaultProvider="AspNetSqlProvider"><properties><add name="sex" type="System.String"/><add name="age" type="System.Int32" /><add name="color" type="System.String"/><add name="birthdate" type="System.DateTime" />

</properties></profile>

Page 15: Asp.net.2.0 beta2 overview

2002-2005 Deep Training/Litwin Consulting, Inc. All Rights Reserved Worldwide. Unauthorized duplication is strictly prohibited.

Page 15

43© 2002-2005 Deep Training/Litwin Consulting, Inc.

Reading/Writing Profile DataReading/Writing Profile DataProfiles.aspxProfiles.aspx

protected void cmdSave_Click(…){

Profile.sex = txtSex.Text;}protected void cmdGet_Click(…){

txtSex.Text = (string)Profile.sex;}

44© 2002-2005 Deep Training/Litwin Consulting, Inc.

Personalization ProfilesPersonalization Profiles

uu Especially useful for customizingEspecially useful for customizing……ll ThemesThemesll Web PartsWeb Parts

45© 2002-2005 Deep Training/Litwin Consulting, Inc.

Themes and SkinsThemes and Skins

Page 16: Asp.net.2.0 beta2 overview

2002-2005 Deep Training/Litwin Consulting, Inc. All Rights Reserved Worldwide. Unauthorized duplication is strictly prohibited.

Page 16

46© 2002-2005 Deep Training/Litwin Consulting, Inc.

Themes & SkinsThemes & Skins

uu ThemeThemell Collection of property settings (skins) that Collection of property settings (skins) that

allow you to define a standard look of allow you to define a standard look of pages and controlspages and controls

uu SkinSkinll Set of visual attributes applied to a controlSet of visual attributes applied to a control

47© 2002-2005 Deep Training/Litwin Consulting, Inc.

What's Themable?What's Themable?

uu Properties that control appearanceProperties that control appearanceuu Does not include content or behavior Does not include content or behavior

attributes such as AllowPaging, attributes such as AllowPaging, AutoPostbackAutoPostback

48© 2002-2005 Deep Training/Litwin Consulting, Inc.

Creating a Theme Creating a Theme –– Basics Basics

uu Create folder under your site's Themes Create folder under your site's Themes folderfolder

uu Theme name is derived from folder Theme name is derived from folder namename

uu Theme folder may contain .skin, .css, Theme folder may contain .skin, .css, and image filesand image files

Page 17: Asp.net.2.0 beta2 overview

2002-2005 Deep Training/Litwin Consulting, Inc. All Rights Reserved Worldwide. Unauthorized duplication is strictly prohibited.

Page 17

49© 2002-2005 Deep Training/Litwin Consulting, Inc.

Creating a Theme Creating a Theme –– Steps Steps

1.1. Add theme folder to app using Add Add theme folder to app using Add Folder|ThemeFolder|Themefolderfolder

2.2. Add .Add .aspxaspx page to theme folder.page to theme folder.3.3. Add controls to pageAdd controls to page

4.4. Customize the look of the controlsCustomize the look of the controls5.5. Remove ID attribute and any attributes that you do Remove ID attribute and any attributes that you do

not want to be part of theme (e.g., Text)not want to be part of theme (e.g., Text)

6.6. Add SkinID attribute to any control to create alternate Add SkinID attribute to any control to create alternate skinsskins

7.7. Remove all nonRemove all non--control content from filecontrol content from file8.8. Rename file to .skin extensionRename file to .skin extension

50© 2002-2005 Deep Training/Litwin Consulting, Inc.

Applying ThemesApplying Themes

uu Add attribute to Page directive of pageAdd attribute to Page directive of pagell Theme attributeTheme attribute

nn Theme settings override any local settingsTheme settings override any local settingsll StyleSheetTheme attributeStyleSheetTheme attribute

nn Local settings override theme settingsLocal settings override theme settingsll Themes can also be applied programmatically in Themes can also be applied programmatically in

the Page_PreInit event by setting the Page's the Page_PreInit event by setting the Page's Theme or StyleSheetTheme propertyTheme or StyleSheetTheme property

uu Reference SkinIDs when appropriate to get Reference SkinIDs when appropriate to get alternate skin for controlalternate skin for control

51© 2002-2005 Deep Training/Litwin Consulting, Inc.

Theme & Skin ExampleTheme & Skin ExampleAdditionalTopics/ThemedSite/ThemesAdditionalTopics/ThemedSite/Themes

Page 18: Asp.net.2.0 beta2 overview

2002-2005 Deep Training/Litwin Consulting, Inc. All Rights Reserved Worldwide. Unauthorized duplication is strictly prohibited.

Page 18

52© 2002-2005 Deep Training/Litwin Consulting, Inc.

Theme & Skin ExampleTheme & Skin ExamplePumpkinPumpkin\\Orange.skinOrange.skin

<asp:Label Runat="server" ForeColor="Orange" Font-Names="Comic Sans MS"></asp:Label><asp:TextBox Runat="server" ForeColor="Orange" Font-Names="Comic Sans MS"></asp:TextBox><asp:Button Runat="server" ForeColor="Orange" Font-Names="Comic Sans MS" />…

<asp:Label SkinId="Reverse" Runat="server" ForeColor="White" BackColor="DarkOrange" Font-Names="Comic Sans MS" ></asp:Label><asp:TextBox SkinId="Reverse" Runat="server" ForeColor="White" BackColor="DarkOrange" Font-Names="Comic Sans MS"></asp:TextBox>

53© 2002-2005 Deep Training/Litwin Consulting, Inc.

Theme & Skin ExampleTheme & Skin ExampleThemedPage.aspxThemedPage.aspx

<%@ Page Language="VB" Theme="Pumpkin" ... %>…<asp:TextBox SkinID="Reverse" ID="txtAge" Runat="server" Width="63px" Height="22px">

54© 2002-2005 Deep Training/Litwin Consulting, Inc.

ThemesThemes

uu Can also be set dynamically from codeCan also be set dynamically from codeuu Need to set theme in Need to set theme in Page_PreInitPage_PreInit eventevent

Page 19: Asp.net.2.0 beta2 overview

2002-2005 Deep Training/Litwin Consulting, Inc. All Rights Reserved Worldwide. Unauthorized duplication is strictly prohibited.

Page 19

55© 2002-2005 Deep Training/Litwin Consulting, Inc.

Other TopicsOther Topics

uu Caching EnhancementsCaching Enhancementsuu CrossCross--Page PostingPage Postinguu Compilation ImprovementsCompilation Improvementsuu Validation GroupsValidation Groups

56© 2002-2005 Deep Training/Litwin Consulting, Inc.

Caching DependenciesCaching Dependencies

uu Work with SQL Server 7/2000Work with SQL Server 7/2000ll Works by ASP.NET polling databaseWorks by ASP.NET polling database

uu Work even better with SQL Server 2005Work even better with SQL Server 2005ll No polling necessaryNo polling necessary

57© 2002-2005 Deep Training/Litwin Consulting, Inc.

Creating SQL Cache Dependency Creating SQL Cache Dependency on SqlDataSourceon SqlDataSource

uu Set a few Set a few properties in properties in property sheetproperty sheet

Page 20: Asp.net.2.0 beta2 overview

2002-2005 Deep Training/Litwin Consulting, Inc. All Rights Reserved Worldwide. Unauthorized duplication is strictly prohibited.

Page 20

58© 2002-2005 Deep Training/Litwin Consulting, Inc.

Creating SQL Cache Dependency Creating SQL Cache Dependency from Codefrom Code

Cache.Insert("dsTitles", dsCache, new SqlCacheDependency("pubs", "titles")

59© 2002-2005 Deep Training/Litwin Consulting, Inc.

CrossCross--Page PostingPage Posting

uu Ability to use Web server controls even when Ability to use Web server controls even when posting across pagesposting across pages

uu Use PostBackUrl property of button control to Use PostBackUrl property of button control to indicate target of postindicate target of post

uu On Target page, you can retrieve control On Target page, you can retrieve control values using code likevalues using code like……

strValue = PreviousPage.FindControl("txtName")

60© 2002-2005 Deep Training/Litwin Consulting, Inc.

What's New in CompilationWhat's New in Compilationuu AutocompileAutocompile anythinganything

ll CS files, VB files, RESX files, and so onCS files, VB files, RESX files, and so onll Simply drop files into special directoriesSimply drop files into special directoriesll Extensible with custom build providersExtensible with custom build providers

uu New codeNew code--behind model behind model ll Fixes fragilities in version 1Fixes fragilities in version 1ll Relies on partial class support in compilersRelies on partial class support in compilers

uu PrecompilePrecompile and deploy without sourceand deploy without sourceuu Much richer Copy Project menuMuch richer Copy Project menu

Page 21: Asp.net.2.0 beta2 overview

2002-2005 Deep Training/Litwin Consulting, Inc. All Rights Reserved Worldwide. Unauthorized duplication is strictly prohibited.

Page 21

61© 2002-2005 Deep Training/Litwin Consulting, Inc.

PrecompilationPrecompilation

uu Precompile.axdPrecompile.axd precompilesprecompiles sites in sites in place to avoid firstplace to avoid first--access delaysaccess delays

62© 2002-2005 Deep Training/Litwin Consulting, Inc.

Deploying without SourceDeploying without Source

uu Aspnet_compiler.exeAspnet_compiler.exe precompilesprecompiles sites sites and deploys and deploys without source codewithout source code

uu Accessible from Visual Studio via Accessible from Visual Studio via Build|PublishBuild|Publish menumenu

63© 2002-2005 Deep Training/Litwin Consulting, Inc.

Validation GroupsValidation GroupsValidGroups.aspxValidGroups.aspx

uu Allows you to group together related Allows you to group together related validation controlsvalidation controls

uu Button in one group will not trigger controls in Button in one group will not trigger controls in a separate groupa separate group

<asp:Button ID="cmdSearchCity" Runat="server" Text="Search" ValidationGroup="CitySearch" />

<asp:RequiredFieldValidator ID="rfvSearchName" Runat="server" ErrorMessage="Enter name."ControlToValidate="txtSearchName" ValidationGroup="NameSearch">

</asp:RequiredFieldValidator>

Page 22: Asp.net.2.0 beta2 overview

2002-2005 Deep Training/Litwin Consulting, Inc. All Rights Reserved Worldwide. Unauthorized duplication is strictly prohibited.

Page 22

64© 2002-2005 Deep Training/Litwin Consulting, Inc.

ConclusionConclusionuu ASP.NET 2.0 is an exciting new updateASP.NET 2.0 is an exciting new updateuu Visual Studio 2005 gets much betterVisual Studio 2005 gets much betteruu Data controls make twoData controls make two--way data binding easy and way data binding easy and

reduce code significantlyreduce code significantlyuu Master pages make visual inheritance of a page template Master pages make visual inheritance of a page template

a snapa snapuu Numerous security enhancements make the management Numerous security enhancements make the management

of users, roles, profiles so much easierof users, roles, profiles so much easieruu Themes allow you to provide a consistent & configurable Themes allow you to provide a consistent & configurable

look to pageslook to pagesuu Other cools features include cache dependencies, Other cools features include cache dependencies,

validation groups, xvalidation groups, x--page posting, page posting, precompilationprecompilation, etc., etc.uu The above features and more make ASP.NET 2.0 / VS The above features and more make ASP.NET 2.0 / VS

2005 a must2005 a must--have upgradehave upgrade

65© 2002-2005 Deep Training/Litwin Consulting, Inc.

Thank YouThank You

uu Download materials (slides/samples)Download materials (slides/samples)ll cds.fhcrc.orgcds.fhcrc.org