SlideShare a Scribd company logo
©2002-2005 Deep Training/Litwin Consulting, Inc. All Rights Reserved Worldwide. Unauthorized duplication is strictly prohibited.
Page 1
ASP.NET 2.0 and VisualASP.NET 2.0 and Visual
Studio 2005 OverviewStudio 2005 Overview
Paul LitwinPaul Litwin
Collaborative Data Services,Collaborative Data Services,
Public Health Sciences,Public Health Sciences,
Fred Hutchinson Cancer Research CenterFred Hutchinson Cancer Research Center
cds.fhcrc.orgcds.fhcrc.org
plitwin@fhcrc.orgplitwin@fhcrc.org
2© 2002-2005 Deep Training/Litwin Consulting, Inc.
New Features at a GlanceNew 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
andAPIs
3© 2002-2005 Deep Training/Litwin Consulting, Inc.
IDE ChangesIDE Changes
©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 project
uu Instead create a new Web SiteInstead create a new Web Site
uu Web sites can beWeb sites can be
filefile--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 yout reformat HTML unless you
ask it to!ask it to!
uu Selection preserved when switchingSelection preserved when switching
between Design and Source (HTML)between Design and Source (HTML)
viewsviews
uu Can now validate HTML againstCan 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 equalbehind and inline code are equal
citizenscitizens
ll Full support for IntelliSense for both stylesFull support for IntelliSense for both styles
ll Choose your style in Add New Item dialogChoose your style in Add New Item dialog
uu Source changes tracked in marginSource changes tracked in margin
ll Unsaved changes in yellowUnsaved changes in yellow
ll Recently saved changes in greenRecently saved changes in green
©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 everywhere
ll HTMLHTML
ll CodeCode
ll Page directivesPage directives
ll Web.configWeb.config
ll Design viewDesign view
nn 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 Files
ll Three ways to edit settingsThree ways to edit settings
1.1. Use IntelliSense within web.config fileUse IntelliSense within web.config file
2.2. Select ASP.NET tab inside of IIS AdminSelect ASP.NET tab inside of IIS Admin
application, click Edit Configuration btnapplication, click Edit Configuration btn
nn Extensive control of web.config settingsExtensive control of web.config settings
3.3. Select Website | ASP.NET ConfigurationSelect Website | ASP.NET Configuration
nn Not as complete as IIS Admin toolNot as complete as IIS Admin tool
nn 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 consistentCreating event handlers now consistent
across languages (VB or C#)across languages (VB or C#)
ll Can do it from property sheetCan do it from property sheet
for both languagesfor both languages
uu Moving windows easierMoving windows easier
ll Thanks to window guidesThanks to window guides
uu Toolbox categorizes controlsToolbox categorizes controls
©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 root
ll 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 System
ll An expanded version of VS that speaks to theAn expanded version of VS that speaks to the
whole design/development/testing lifewhole design/development/testing life--cyclecycle
nn client/server, collaboration basedclient/server, collaboration based
nn robust/scalable source controlrobust/scalable source control
nn work item (e.g., bugs) trackingwork item (e.g., bugs) tracking
nn unit testing, load testingunit testing, load testing
nn code analysiscode analysis
nn project portalproject portal
nn lots morelots more……
12© 2002-2005 Deep Training/Litwin Consulting, Inc.
Expanding Visual StudioExpanding Visual Studio
EvaluateEvaluate
.NET.NET
Interact withInteract with
studentsstudents
Build coolBuild cool
appsapps
Learn howLearn how
to programto program
HobbyistsHobbyists
StudentsStudents FacultyFaculty
EnthusiastsEnthusiasts
©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
Project
Manager
Application
Architect
Developer Tester
Infrastructure
Architect
Team Foundation ServerTeam Foundation Server
Users &
Management
Web Browser
Team Explorer
VSTE/STVSTE/SD
VSTE/SA
WorkWork
ItemsItems
BuildBuild
ServerServer
SourceSource
ControlControl
ProjectProject
PortalPortal
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
©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--wayway
binding syntax but you still had to writebinding syntax but you still had to write
quite a bit of code to get data in and outquite 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--wayway
(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 dataA family of controls that assist in data
bindingbinding
ll Middleman between data bound controlsMiddleman between data bound controls
and data sourcesand data sources
uu Types of Data Source ControlsTypes of Data Source Controls
ll TabularTabular
nn SqlDataSourceSqlDataSource
nn AccessDataSourceAccessDataSource
nn ObjectDataSourceObjectDataSource
ll HierarchicalHierarchical
nn XmlDataSourceXmlDataSource
nn SiteMapDataSourceSiteMapDataSource
18© 2002-2005 Deep Training/Litwin Consulting, Inc.
New 2.0 DataNew 2.0 Data--Bound ControlsBound Controls
uu List ControlsList Controls
ll BulletedListBulletedList
uu Composite ControlsComposite Controls
ll GridViewGridView
ll DetailsViewDetailsView
ll FormViewFormView
uu Hierarchical ControlsHierarchical Controls
ll TreeViewTreeView
ll MenuMenu
©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 Control
Example:Example: GridView.aspxGridView.aspx
uu AA ““codecode--lessless”” DataGridDataGrid
uu WalkWalk--through of grid with automaticthrough of grid with automatic
sorting (ascending & descending),sorting (ascending & descending),
paginationpagination
1.1. AddAdd GridViewGridView to pageto page
2.2. UsingUsing GridViewGridView Tasks pane, chooseTasks pane, choose
DataSourceDataSource
3.3. CheckCheck EnablePagingEnablePaging && EnableSortingEnableSorting
20© 2002-2005 Deep Training/Litwin Consulting, Inc.
GridView with UpdatingGridView with Updating
Example: GridViewUpdate1.aspxExample: GridViewUpdate1.aspx
uu Can also be done without codeCan also be done without code
1.1. AddAdd GridViewGridView to pageto page
2.2. Choose Data SourceChoose Data Source
ll On "Configure the select statement" pageOn "Configure the select statement" page
ll Click Advanced OptionsClick Advanced Options
ll CheckCheck ““Generate Insert, Update, and DeleteGenerate Insert, Update, and Delete
statementsstatements””
3.3. Configure GridViewConfigure GridView
ll CheckCheck ““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 theASP.NET 1.x provided no help to the
developer having to create a singledeveloper having to create a single--recordrecord
““formform”” view of dataview of data
uu ASP.NET 2.0 gives us two solutionsASP.NET 2.0 gives us two solutions
ll DetailsViewDetailsView –– fixed look (supports styles but nofixed look (supports styles but no
field templates); can't get at individual fieldsfield templates); can't get at individual fields
ll FormViewFormView –– fully templated (VS will generate basicfully 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
©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. DetailsViewDetailsView
ControlsControls
23© 2002-2005 Deep Training/Litwin Consulting, Inc.
Master Pages and NavigationMaster Pages and Navigation
24© 2002-2005 Deep Training/Litwin Consulting, Inc.
NavigationNavigation
uu Three PiecesThree Pieces
1.1. Navigation SiteMapNavigation SiteMap
nn Web.sitemap XML fileWeb.sitemap XML file
nn Allows you to create a sitemap for navigationAllows you to create a sitemap for navigation
purposespurposes
2.2. SiteMapDataSourceSiteMapDataSource
nn Reads Web.sitemap file and makes availableReads Web.sitemap file and makes available
to TreeView controlto TreeView control
3.3. ControlsControls
nn TreeViewTreeView –– displays navigation treedisplays navigation tree
nn MenuMenu –– displays flyout menusdisplays flyout menus
nn SiteMapPathSiteMapPath –– "breadcrumb" path"breadcrumb" path
©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: lacklack
of any easy way to create pageof 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 Pages
ll Easy and powerful way to create a commonEasy 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 site
ll Support for multiple levels of master pagesSupport for multiple levels of master pages
ll WYSIWYG support for master pages inWYSIWYG 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 pageArrange content on master page
(.master extension)(.master extension)
ll Add placeholders for content pages usingAdd placeholders for content pages using
the ContentPlaceHolder elementthe ContentPlaceHolder element
uu Create pages based on master pageCreate pages based on master page
ll UseUse MasterPageFileMasterPageFile attribute in pageattribute in page
directivedirective
ll Add content to Content elementAdd content to Content element
27© 2002-2005 Deep Training/Litwin Consulting, Inc.
Master Pages DemoMaster Pages Demo
©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 SecurityLogin 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 Controls
ll UI controls for managing login of usersUI controls for managing login of users
uu MembershipMembership
ll Standardized solution for storing formsStandardized solution for storing forms
authentication dataauthentication data
ll Membership.ValidateUser methodMembership.ValidateUser method
ll Login controls wrap up membership serviceLogin controls wrap up membership service
ll 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 toSimplifies authorization code you have to
writewrite
ll ProviderProvider--basedbased
uu PersonalizationPersonalization
ll Simplifies storing of site personalizationSimplifies storing of site personalization
data in user profilesdata in user profiles
ll Support for stronglySupport for strongly--typed profile propertiestyped profile properties
ll ProviderProvider--basedbased
©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
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
andAPIs
32© 2002-2005 Deep Training/Litwin Consulting, Inc.
Forms AuthenticationForms Authentication
<authentication mode="Forms">
<forms name="name"
cookieless=UseCookie|UseUri|AutoDetect|
UseDeviceProfile
defaultUrl=[URL]
domain=domain name
loginUrl="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 throughWalks you through
setting upsetting up
authentication,authentication,
membershipmembership
provider, users, andprovider, users, and
role managementrole management
for Web sitefor Web site
uu Can setup Forms orCan setup Forms or
Windows authWindows auth
uu Start wizard fromStart wizard from
Web Site AdminWeb Site Admin
Tool (Tool (Website |Website |
ASP.NET ConfigurationASP.NET Configuration))
©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 Controls
uu LoginLogin –– log in users (goes on login page)log in users (goes on login page)
uu LoginViewLoginView –– displays different viewsdisplays different views
based on whether user is authenticatedbased on whether user is authenticated
uu PasswordRecoveryPasswordRecovery –– recover or resetrecover or reset
lost passwordlost password
uu LoginStatusLoginStatus –– displays login or logoutdisplays login or logout
linklink
uu LoginNameLoginName –– displays login name fordisplays login name for
authenticated usersauthenticated users
uu CreateUserWizardCreateUserWizard –– steps user throughsteps user through
wizard to create new accountwizard to create new account
uu ChangePasswordChangePassword –– changes passwordchanges 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 Service
uu Saves you from having to manage users andSaves you from having to manage users and
passwordspasswords
uu Login controls may obviate need to directly work withLogin 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 User
nn Membership.ValidateUser()Membership.ValidateUser()
ll Find User by Email addressFind User by Email address
nn Membership.FindUsersByEmail()Membership.FindUsersByEmail()
ll Estimate number of users onlineEstimate number of users online
nn Membership.GetNumberOfUsersOnline()Membership.GetNumberOfUsersOnline()
©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 Service
uu Simplifies authorization using rolesSimplifies authorization using roles
uu Manage roles at design time using ASP.NETManage roles at design time using ASP.NET
Web Admin toolWeb Admin tool
ll Or use Roles and RoleProvider classes at runtimeOr use Roles and RoleProvider classes at runtime
uu Use LoginView control to display customUse LoginView control to display custom
content per rolecontent per role
ll Order RoleGroup elements from highest to lowestOrder 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 Service
uu Role data carried between pages by ASP.NETRole data carried between pages by ASP.NET
using encrypted cookiesusing encrypted cookies
uu Reduces roundReduces round--trips to database for roletrips to database for role
informationinformation
39© 2002-2005 Deep Training/Litwin Consulting, Inc.
LoginView Roles ExampleLoginView Roles Example
LoginView.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>
©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 Example
Roles.aspx.csRoles.aspx.cs
protected void Page_Load(…)
{
// Order by highest to lowest
if (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 toNo need to create fields in a database to
keep track of personalization datakeep track of personalization data
uu Allows you to strongly type yourAllows you to strongly type your
personalization datapersonalization data
uu You maintain personalization data inYou 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>
©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 Data
Profiles.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 ThemesThemes
ll Web PartsWeb Parts
45© 2002-2005 Deep Training/Litwin Consulting, Inc.
Themes and SkinsThemes and Skins
©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 ThemeTheme
ll Collection of property settings (skins) thatCollection of property settings (skins) that
allow you to define a standard look ofallow you to define a standard look of
pages and controlspages and controls
uu SkinSkin
ll 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 appearance
uu Does not include content or behaviorDoes not include content or behavior
attributes such as AllowPaging,attributes such as AllowPaging,
AutoPostbackAutoPostback
48© 2002-2005 Deep Training/Litwin Consulting, Inc.
Creating a ThemeCreating a Theme –– BasicsBasics
uu Create folder under your site's ThemesCreate folder under your site's Themes
folderfolder
uu Theme name is derived from folderTheme name is derived from folder
namename
uu Theme folder may contain .skin, .css,Theme folder may contain .skin, .css,
and image filesand image files
©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 ThemeCreating a Theme –– StepsSteps
1.1. Add theme folder to app using AddAdd theme folder to app using Add Folder|ThemeFolder|Theme
folderfolder
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 controls
5.5. Remove ID attribute and any attributes that you doRemove 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 alternateAdd SkinID attribute to any control to create alternate
skinsskins
7.7. Remove all nonRemove all non--control content from filecontrol content from file
8.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 page
ll Theme attributeTheme attribute
nn Theme settings override any local settingsTheme settings override any local settings
ll StyleSheetTheme attributeStyleSheetTheme attribute
nn Local settings override theme settingsLocal settings override theme settings
ll Themes can also be applied programmatically inThemes can also be applied programmatically in
the Page_PreInit event by setting the Page'sthe Page_PreInit event by setting the Page's
Theme or StyleSheetTheme propertyTheme or StyleSheetTheme property
uu Reference SkinIDs when appropriate to getReference SkinIDs when appropriate to get
alternate skin for controlalternate skin for control
51© 2002-2005 Deep Training/Litwin Consulting, Inc.
Theme & Skin ExampleTheme & Skin Example
AdditionalTopics/ThemedSite/ThemesAdditionalTopics/ThemedSite/Themes
©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 Example
PumpkinPumpkinOrange.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 Example
ThemedPage.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 code
uu Need to set theme inNeed to set theme in Page_PreInitPage_PreInit eventevent
©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 Enhancements
uu CrossCross--Page PostingPage Posting
uu Compilation ImprovementsCompilation Improvements
uu 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/2000
ll Works by ASP.NET polling databaseWorks by ASP.NET polling database
uu Work even better with SQL Server 2005Work even better with SQL Server 2005
ll No polling necessaryNo polling necessary
57© 2002-2005 Deep Training/Litwin Consulting, Inc.
Creating SQL Cache DependencyCreating SQL Cache Dependency
on SqlDataSourceon SqlDataSource
uu Set a fewSet a few
properties inproperties in
property sheetproperty sheet
©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 DependencyCreating 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 whenAbility to use Web server controls even when
posting across pagesposting across pages
uu Use PostBackUrl property of button control toUse PostBackUrl property of button control to
indicate target of postindicate target of post
uu On Target page, you can retrieve controlOn 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 Compilation
uu AutocompileAutocompile anythinganything
ll CS files, VB files, RESX files, and so onCS files, VB files, RESX files, and so on
ll Simply drop files into special directoriesSimply drop files into special directories
ll Extensible with custom build providersExtensible with custom build providers
uu New codeNew code--behind modelbehind model
ll Fixes fragilities in version 1Fixes fragilities in version 1
ll Relies on partial class support in compilersRelies on partial class support in compilers
uu PrecompilePrecompile and deploy without sourceand deploy without source
uu Much richer Copy Project menuMuch richer Copy Project menu
©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 insites 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 sitessites
and deploysand deploys without source codewithout source code
uu Accessible from Visual Studio viaAccessible from Visual Studio via
Build|PublishBuild|Publish menumenu
63© 2002-2005 Deep Training/Litwin Consulting, Inc.
Validation GroupsValidation Groups
ValidGroups.aspxValidGroups.aspx
uu Allows you to group together relatedAllows you to group together related
validation controlsvalidation controls
uu Button in one group will not trigger controls inButton 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>
©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.
ConclusionConclusion
uu ASP.NET 2.0 is an exciting new updateASP.NET 2.0 is an exciting new update
uu Visual Studio 2005 gets much betterVisual Studio 2005 gets much better
uu Data controls make twoData controls make two--way data binding easy andway data binding easy and
reduce code significantlyreduce code significantly
uu Master pages make visual inheritance of a page templateMaster pages make visual inheritance of a page template
a snapa snap
uu Numerous security enhancements make the managementNumerous security enhancements make the management
of users, roles, profiles so much easierof users, roles, profiles so much easier
uu Themes allow you to provide a consistent & configurableThemes allow you to provide a consistent & configurable
look to pageslook to pages
uu 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 / VSThe 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

More Related Content

PDF
Cee cls employee engagement and productivity mgw 27 feb2013, kl, malaysia
PPTX
Google scholar
PPTX
Coral reefs
PDF
ONLINET CDS queue management software
PPT
The necklace summary (1)
PDF
PPT
Learning with F#
PDF
Certified ASP.Net Programmer
Cee cls employee engagement and productivity mgw 27 feb2013, kl, malaysia
Google scholar
Coral reefs
ONLINET CDS queue management software
The necklace summary (1)
Learning with F#
Certified ASP.Net Programmer

Similar to Asp.net.2.0 beta2 overview (20)

PDF
Programming Microsoft SQL Server 2000 with Microsoft Visual Basic NET 1st edi...
PDF
Programming Microsoft SQL Server 2000 with Microsoft Visual Basic NET 1st edi...
PDF
Asp.net Programmer Certification
PDF
Programming Microsoft SQL Server 2000 with Microsoft Visual Basic NET 1st edi...
PDF
Programming Microsoft SQL Server 2000 with Microsoft Visual Basic NET 1st edi...
PDF
Programming Microsoft SQL Server 2000 with Microsoft Visual Basic NET 1st edi...
PPT
Visual Studio 2008 & .Net 3.5
PDF
Vs2010 Apiit Mix On Campus_Ngan Seok Chern
PPTX
PDF
Advanced Programming Using Visual Basic 2008 4th Edition Julia Case Bradley
PPT
ASPNET for PHP Developers
PDF
asp.net course in pune
PPTX
Dot net online training
PPTX
.NET ONLINE TRAINING COURSE CONTENT
PPTX
.net online training
PPTX
Whats New In 2010 (Msdn & Visual Studio)
PDF
Net course content
PPSX
06 asp.net session08
PPTX
A Web Developer's Journey across different versions of ASP.NET
PPT
Microsoft .Net Framework 2 0
Programming Microsoft SQL Server 2000 with Microsoft Visual Basic NET 1st edi...
Programming Microsoft SQL Server 2000 with Microsoft Visual Basic NET 1st edi...
Asp.net Programmer Certification
Programming Microsoft SQL Server 2000 with Microsoft Visual Basic NET 1st edi...
Programming Microsoft SQL Server 2000 with Microsoft Visual Basic NET 1st edi...
Programming Microsoft SQL Server 2000 with Microsoft Visual Basic NET 1st edi...
Visual Studio 2008 & .Net 3.5
Vs2010 Apiit Mix On Campus_Ngan Seok Chern
Advanced Programming Using Visual Basic 2008 4th Edition Julia Case Bradley
ASPNET for PHP Developers
asp.net course in pune
Dot net online training
.NET ONLINE TRAINING COURSE CONTENT
.net online training
Whats New In 2010 (Msdn & Visual Studio)
Net course content
06 asp.net session08
A Web Developer's Journey across different versions of ASP.NET
Microsoft .Net Framework 2 0
Ad

Recently uploaded (20)

PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Cell Structure & Organelles in detailed.
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Lesson notes of climatology university.
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Pharma ospi slides which help in ospi learning
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Computing-Curriculum for Schools in Ghana
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
01-Introduction-to-Information-Management.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
RMMM.pdf make it easy to upload and study
O5-L3 Freight Transport Ops (International) V1.pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Cell Structure & Organelles in detailed.
Supply Chain Operations Speaking Notes -ICLT Program
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Lesson notes of climatology university.
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Pharma ospi slides which help in ospi learning
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Final Presentation General Medicine 03-08-2024.pptx
Weekly quiz Compilation Jan -July 25.pdf
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
VCE English Exam - Section C Student Revision Booklet
Computing-Curriculum for Schools in Ghana
Chinmaya Tiranga quiz Grand Finale.pdf
Microbial diseases, their pathogenesis and prophylaxis
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
01-Introduction-to-Information-Management.pdf
Microbial disease of the cardiovascular and lymphatic systems
RMMM.pdf make it easy to upload and study
Ad

Asp.net.2.0 beta2 overview

  • 1. ©2002-2005 Deep Training/Litwin Consulting, Inc. All Rights Reserved Worldwide. Unauthorized duplication is strictly prohibited. Page 1 ASP.NET 2.0 and VisualASP.NET 2.0 and Visual Studio 2005 OverviewStudio 2005 Overview Paul LitwinPaul Litwin Collaborative Data Services,Collaborative Data Services, Public Health Sciences,Public Health Sciences, Fred Hutchinson Cancer Research CenterFred Hutchinson Cancer Research Center cds.fhcrc.orgcds.fhcrc.org plitwin@fhcrc.orgplitwin@fhcrc.org 2© 2002-2005 Deep Training/Litwin Consulting, Inc. New Features at a GlanceNew 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 andAPIs 3© 2002-2005 Deep Training/Litwin Consulting, Inc. IDE ChangesIDE Changes
  • 2. ©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 project uu Instead create a new Web SiteInstead create a new Web Site uu Web sites can beWeb sites can be filefile--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 yout reformat HTML unless you ask it to!ask it to! uu Selection preserved when switchingSelection preserved when switching between Design and Source (HTML)between Design and Source (HTML) viewsviews uu Can now validate HTML againstCan 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 equalbehind and inline code are equal citizenscitizens ll Full support for IntelliSense for both stylesFull support for IntelliSense for both styles ll Choose your style in Add New Item dialogChoose your style in Add New Item dialog uu Source changes tracked in marginSource changes tracked in margin ll Unsaved changes in yellowUnsaved changes in yellow ll Recently saved changes in greenRecently saved changes in green
  • 3. ©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 everywhere ll HTMLHTML ll CodeCode ll Page directivesPage directives ll Web.configWeb.config ll Design viewDesign view nn 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 Files ll Three ways to edit settingsThree ways to edit settings 1.1. Use IntelliSense within web.config fileUse IntelliSense within web.config file 2.2. Select ASP.NET tab inside of IIS AdminSelect ASP.NET tab inside of IIS Admin application, click Edit Configuration btnapplication, click Edit Configuration btn nn Extensive control of web.config settingsExtensive control of web.config settings 3.3. Select Website | ASP.NET ConfigurationSelect Website | ASP.NET Configuration nn Not as complete as IIS Admin toolNot as complete as IIS Admin tool nn 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 consistentCreating event handlers now consistent across languages (VB or C#)across languages (VB or C#) ll Can do it from property sheetCan do it from property sheet for both languagesfor both languages uu Moving windows easierMoving windows easier ll Thanks to window guidesThanks to window guides uu Toolbox categorizes controlsToolbox categorizes controls
  • 4. ©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 root ll 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 System ll An expanded version of VS that speaks to theAn expanded version of VS that speaks to the whole design/development/testing lifewhole design/development/testing life--cyclecycle nn client/server, collaboration basedclient/server, collaboration based nn robust/scalable source controlrobust/scalable source control nn work item (e.g., bugs) trackingwork item (e.g., bugs) tracking nn unit testing, load testingunit testing, load testing nn code analysiscode analysis nn project portalproject portal nn lots morelots more…… 12© 2002-2005 Deep Training/Litwin Consulting, Inc. Expanding Visual StudioExpanding Visual Studio EvaluateEvaluate .NET.NET Interact withInteract with studentsstudents Build coolBuild cool appsapps Learn howLearn how to programto program HobbyistsHobbyists StudentsStudents FacultyFaculty EnthusiastsEnthusiasts
  • 5. ©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 Project Manager Application Architect Developer Tester Infrastructure Architect Team Foundation ServerTeam Foundation Server Users & Management Web Browser Team Explorer VSTE/STVSTE/SD VSTE/SA WorkWork ItemsItems BuildBuild ServerServer SourceSource ControlControl ProjectProject PortalPortal 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
  • 6. ©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--wayway binding syntax but you still had to writebinding syntax but you still had to write quite a bit of code to get data in and outquite 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--wayway (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 dataA family of controls that assist in data bindingbinding ll Middleman between data bound controlsMiddleman between data bound controls and data sourcesand data sources uu Types of Data Source ControlsTypes of Data Source Controls ll TabularTabular nn SqlDataSourceSqlDataSource nn AccessDataSourceAccessDataSource nn ObjectDataSourceObjectDataSource ll HierarchicalHierarchical nn XmlDataSourceXmlDataSource nn SiteMapDataSourceSiteMapDataSource 18© 2002-2005 Deep Training/Litwin Consulting, Inc. New 2.0 DataNew 2.0 Data--Bound ControlsBound Controls uu List ControlsList Controls ll BulletedListBulletedList uu Composite ControlsComposite Controls ll GridViewGridView ll DetailsViewDetailsView ll FormViewFormView uu Hierarchical ControlsHierarchical Controls ll TreeViewTreeView ll MenuMenu
  • 7. ©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 Control Example:Example: GridView.aspxGridView.aspx uu AA ““codecode--lessless”” DataGridDataGrid uu WalkWalk--through of grid with automaticthrough of grid with automatic sorting (ascending & descending),sorting (ascending & descending), paginationpagination 1.1. AddAdd GridViewGridView to pageto page 2.2. UsingUsing GridViewGridView Tasks pane, chooseTasks pane, choose DataSourceDataSource 3.3. CheckCheck EnablePagingEnablePaging && EnableSortingEnableSorting 20© 2002-2005 Deep Training/Litwin Consulting, Inc. GridView with UpdatingGridView with Updating Example: GridViewUpdate1.aspxExample: GridViewUpdate1.aspx uu Can also be done without codeCan also be done without code 1.1. AddAdd GridViewGridView to pageto page 2.2. Choose Data SourceChoose Data Source ll On "Configure the select statement" pageOn "Configure the select statement" page ll Click Advanced OptionsClick Advanced Options ll CheckCheck ““Generate Insert, Update, and DeleteGenerate Insert, Update, and Delete statementsstatements”” 3.3. Configure GridViewConfigure GridView ll CheckCheck ““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 theASP.NET 1.x provided no help to the developer having to create a singledeveloper having to create a single--recordrecord ““formform”” view of dataview of data uu ASP.NET 2.0 gives us two solutionsASP.NET 2.0 gives us two solutions ll DetailsViewDetailsView –– fixed look (supports styles but nofixed look (supports styles but no field templates); can't get at individual fieldsfield templates); can't get at individual fields ll FormViewFormView –– fully templated (VS will generate basicfully 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
  • 8. ©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. DetailsViewDetailsView ControlsControls 23© 2002-2005 Deep Training/Litwin Consulting, Inc. Master Pages and NavigationMaster Pages and Navigation 24© 2002-2005 Deep Training/Litwin Consulting, Inc. NavigationNavigation uu Three PiecesThree Pieces 1.1. Navigation SiteMapNavigation SiteMap nn Web.sitemap XML fileWeb.sitemap XML file nn Allows you to create a sitemap for navigationAllows you to create a sitemap for navigation purposespurposes 2.2. SiteMapDataSourceSiteMapDataSource nn Reads Web.sitemap file and makes availableReads Web.sitemap file and makes available to TreeView controlto TreeView control 3.3. ControlsControls nn TreeViewTreeView –– displays navigation treedisplays navigation tree nn MenuMenu –– displays flyout menusdisplays flyout menus nn SiteMapPathSiteMapPath –– "breadcrumb" path"breadcrumb" path
  • 9. ©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: lacklack of any easy way to create pageof 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 Pages ll Easy and powerful way to create a commonEasy 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 site ll Support for multiple levels of master pagesSupport for multiple levels of master pages ll WYSIWYG support for master pages inWYSIWYG 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 pageArrange content on master page (.master extension)(.master extension) ll Add placeholders for content pages usingAdd placeholders for content pages using the ContentPlaceHolder elementthe ContentPlaceHolder element uu Create pages based on master pageCreate pages based on master page ll UseUse MasterPageFileMasterPageFile attribute in pageattribute in page directivedirective ll Add content to Content elementAdd content to Content element 27© 2002-2005 Deep Training/Litwin Consulting, Inc. Master Pages DemoMaster Pages Demo
  • 10. ©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 SecurityLogin 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 Controls ll UI controls for managing login of usersUI controls for managing login of users uu MembershipMembership ll Standardized solution for storing formsStandardized solution for storing forms authentication dataauthentication data ll Membership.ValidateUser methodMembership.ValidateUser method ll Login controls wrap up membership serviceLogin controls wrap up membership service ll 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 toSimplifies authorization code you have to writewrite ll ProviderProvider--basedbased uu PersonalizationPersonalization ll Simplifies storing of site personalizationSimplifies storing of site personalization data in user profilesdata in user profiles ll Support for stronglySupport for strongly--typed profile propertiestyped profile properties ll ProviderProvider--basedbased
  • 11. ©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 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 andAPIs 32© 2002-2005 Deep Training/Litwin Consulting, Inc. Forms AuthenticationForms Authentication <authentication mode="Forms"> <forms name="name" cookieless=UseCookie|UseUri|AutoDetect| UseDeviceProfile defaultUrl=[URL] domain=domain name loginUrl="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 throughWalks you through setting upsetting up authentication,authentication, membershipmembership provider, users, andprovider, users, and role managementrole management for Web sitefor Web site uu Can setup Forms orCan setup Forms or Windows authWindows auth uu Start wizard fromStart wizard from Web Site AdminWeb Site Admin Tool (Tool (Website |Website | ASP.NET ConfigurationASP.NET Configuration))
  • 12. ©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 Controls uu LoginLogin –– log in users (goes on login page)log in users (goes on login page) uu LoginViewLoginView –– displays different viewsdisplays different views based on whether user is authenticatedbased on whether user is authenticated uu PasswordRecoveryPasswordRecovery –– recover or resetrecover or reset lost passwordlost password uu LoginStatusLoginStatus –– displays login or logoutdisplays login or logout linklink uu LoginNameLoginName –– displays login name fordisplays login name for authenticated usersauthenticated users uu CreateUserWizardCreateUserWizard –– steps user throughsteps user through wizard to create new accountwizard to create new account uu ChangePasswordChangePassword –– changes passwordchanges 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 Service uu Saves you from having to manage users andSaves you from having to manage users and passwordspasswords uu Login controls may obviate need to directly work withLogin 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 User nn Membership.ValidateUser()Membership.ValidateUser() ll Find User by Email addressFind User by Email address nn Membership.FindUsersByEmail()Membership.FindUsersByEmail() ll Estimate number of users onlineEstimate number of users online nn Membership.GetNumberOfUsersOnline()Membership.GetNumberOfUsersOnline()
  • 13. ©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 Service uu Simplifies authorization using rolesSimplifies authorization using roles uu Manage roles at design time using ASP.NETManage roles at design time using ASP.NET Web Admin toolWeb Admin tool ll Or use Roles and RoleProvider classes at runtimeOr use Roles and RoleProvider classes at runtime uu Use LoginView control to display customUse LoginView control to display custom content per rolecontent per role ll Order RoleGroup elements from highest to lowestOrder 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 Service uu Role data carried between pages by ASP.NETRole data carried between pages by ASP.NET using encrypted cookiesusing encrypted cookies uu Reduces roundReduces round--trips to database for roletrips to database for role informationinformation 39© 2002-2005 Deep Training/Litwin Consulting, Inc. LoginView Roles ExampleLoginView Roles Example LoginView.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>
  • 14. ©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 Example Roles.aspx.csRoles.aspx.cs protected void Page_Load(…) { // Order by highest to lowest if (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 toNo need to create fields in a database to keep track of personalization datakeep track of personalization data uu Allows you to strongly type yourAllows you to strongly type your personalization datapersonalization data uu You maintain personalization data inYou 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>
  • 15. ©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 Data Profiles.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 ThemesThemes ll Web PartsWeb Parts 45© 2002-2005 Deep Training/Litwin Consulting, Inc. Themes and SkinsThemes and Skins
  • 16. ©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 ThemeTheme ll Collection of property settings (skins) thatCollection of property settings (skins) that allow you to define a standard look ofallow you to define a standard look of pages and controlspages and controls uu SkinSkin ll 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 appearance uu Does not include content or behaviorDoes not include content or behavior attributes such as AllowPaging,attributes such as AllowPaging, AutoPostbackAutoPostback 48© 2002-2005 Deep Training/Litwin Consulting, Inc. Creating a ThemeCreating a Theme –– BasicsBasics uu Create folder under your site's ThemesCreate folder under your site's Themes folderfolder uu Theme name is derived from folderTheme name is derived from folder namename uu Theme folder may contain .skin, .css,Theme folder may contain .skin, .css, and image filesand image files
  • 17. ©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 ThemeCreating a Theme –– StepsSteps 1.1. Add theme folder to app using AddAdd theme folder to app using Add Folder|ThemeFolder|Theme folderfolder 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 controls 5.5. Remove ID attribute and any attributes that you doRemove 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 alternateAdd SkinID attribute to any control to create alternate skinsskins 7.7. Remove all nonRemove all non--control content from filecontrol content from file 8.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 page ll Theme attributeTheme attribute nn Theme settings override any local settingsTheme settings override any local settings ll StyleSheetTheme attributeStyleSheetTheme attribute nn Local settings override theme settingsLocal settings override theme settings ll Themes can also be applied programmatically inThemes can also be applied programmatically in the Page_PreInit event by setting the Page'sthe Page_PreInit event by setting the Page's Theme or StyleSheetTheme propertyTheme or StyleSheetTheme property uu Reference SkinIDs when appropriate to getReference SkinIDs when appropriate to get alternate skin for controlalternate skin for control 51© 2002-2005 Deep Training/Litwin Consulting, Inc. Theme & Skin ExampleTheme & Skin Example AdditionalTopics/ThemedSite/ThemesAdditionalTopics/ThemedSite/Themes
  • 18. ©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 Example PumpkinPumpkinOrange.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 Example ThemedPage.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 code uu Need to set theme inNeed to set theme in Page_PreInitPage_PreInit eventevent
  • 19. ©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 Enhancements uu CrossCross--Page PostingPage Posting uu Compilation ImprovementsCompilation Improvements uu 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/2000 ll Works by ASP.NET polling databaseWorks by ASP.NET polling database uu Work even better with SQL Server 2005Work even better with SQL Server 2005 ll No polling necessaryNo polling necessary 57© 2002-2005 Deep Training/Litwin Consulting, Inc. Creating SQL Cache DependencyCreating SQL Cache Dependency on SqlDataSourceon SqlDataSource uu Set a fewSet a few properties inproperties in property sheetproperty sheet
  • 20. ©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 DependencyCreating 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 whenAbility to use Web server controls even when posting across pagesposting across pages uu Use PostBackUrl property of button control toUse PostBackUrl property of button control to indicate target of postindicate target of post uu On Target page, you can retrieve controlOn 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 Compilation uu AutocompileAutocompile anythinganything ll CS files, VB files, RESX files, and so onCS files, VB files, RESX files, and so on ll Simply drop files into special directoriesSimply drop files into special directories ll Extensible with custom build providersExtensible with custom build providers uu New codeNew code--behind modelbehind model ll Fixes fragilities in version 1Fixes fragilities in version 1 ll Relies on partial class support in compilersRelies on partial class support in compilers uu PrecompilePrecompile and deploy without sourceand deploy without source uu Much richer Copy Project menuMuch richer Copy Project menu
  • 21. ©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 insites 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 sitessites and deploysand deploys without source codewithout source code uu Accessible from Visual Studio viaAccessible from Visual Studio via Build|PublishBuild|Publish menumenu 63© 2002-2005 Deep Training/Litwin Consulting, Inc. Validation GroupsValidation Groups ValidGroups.aspxValidGroups.aspx uu Allows you to group together relatedAllows you to group together related validation controlsvalidation controls uu Button in one group will not trigger controls inButton 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>
  • 22. ©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. ConclusionConclusion uu ASP.NET 2.0 is an exciting new updateASP.NET 2.0 is an exciting new update uu Visual Studio 2005 gets much betterVisual Studio 2005 gets much better uu Data controls make twoData controls make two--way data binding easy andway data binding easy and reduce code significantlyreduce code significantly uu Master pages make visual inheritance of a page templateMaster pages make visual inheritance of a page template a snapa snap uu Numerous security enhancements make the managementNumerous security enhancements make the management of users, roles, profiles so much easierof users, roles, profiles so much easier uu Themes allow you to provide a consistent & configurableThemes allow you to provide a consistent & configurable look to pageslook to pages uu 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 / VSThe 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