ASP.NET 2.0 Tips Tricks Tips Tricks for ASP.NET 2.0

Reviews
Shared by: The Slasher
Stats
views:
133
rating:
not rated
reviews:
0
posted:
1/18/2009
language:
English
pages:
0
ASP.NET 2.0 Tips & Tricks Tips & Tricks for ASP.NET 2.0 Rob Howard Telligent Microsoft Regional Director For more information… Rob Howard Email: rhoward@telligent.com Website: telligent.com Blog: weblogs.asp.net/rhoward Telligent Community Server (communityserver.org) Custom Application Development (ASP.NET) Agenda 1. Cross Page Posting 2. Validation Groups 3. Wizard Control and Profile Registration 4. Secure Connection String Storage 5. Config-based Control Registration 6. Caching Features 7. Client Script Goodies, Client Callbacks 8. XML Databinding to build a Blog Reader 9. URL Rewriting 10. Site Map 1. Cross Page Posting Problem Postback model isn’t always desired Scenario: Search or lookup button at top of page New “PostBackUrl” property Declaratively or programmatically set Page posted to has strongly typed access Access controls via “Page.PreviousPage” property <%@ PreviousPage VirtualPath=“a.aspx” %> Cross Page Posting 2. Validation Groups Problem Today validation controls apply “all or nothing” ASP.NET 2.0 “ValidationGroup” property Supported by all Validation and Postback controls Controls in ValidationGroup validate with postback Programmatic Support for Validating Groups If (Page.Validate(“group_name”)) Then Page.IsValid evaluates ValidationGroup Postback Validation Groups 3. Wizard Control Problem Difficult to build Wizard style UI today Enables linear and non-linear navigation Developer defines templated “steps” within control Control state maintained throughout wizard steps Flexible Wizard Control Navigation Model MoveTo(wizardStep), ActiveStepIndex, etc Events can fire on steps and completion Wizard Control 4. Connection String Storage Persistence and declarative referencing Stored in *.config Avoid hard-coding within pages/code Can be optionally encrypted Built-in design time support Promote use for best practices Enable optional encrypting of values in config Admin Support MMC Admin Tool Support Configuration API Support Config Connection Strings Web.config: Control Registration 6. Caching SQL 7 & 2000 Support Table change dependencies on SQL 7 & 2000 Requires configuration settings One-time setup of SQL Server database Polling model SQL Server “Yukon” Result Set dependencies for SQL Yukon Supported through ADO.NET SqlCommand No setup required Notification model SQL Server 7 & 2000 Table level notifications only Notification when data in table changes Row-level notification is not supported Requires one time setup of SQL 7 / 2000 Triggers on tables that participate Stored procedures called to check Of Note: Entries in cache table < # of tables in DB Entries in cache = # items in cache table Data Caching How it works: SQL 7 & 2000 ASP.NET Cache SqlCacheDependency Page DataSet SQL Server Northwind Database Products table N n1 data a z trigger ChangeNotification table tableName aspnet_regsql.exe changeId products 3 1 7. Client Script Goodies Client-side click event handlers on controls: Focus mechanisms: Page.SetFocus(control) TextBox.Focus() Default button and focus Client Script Goodies Validation Error Focus “SetFocusOnError” property Auto-scroll maintenance on postback Ideal for large pages – no code required Simplified Client Script Registration Page.ClientScript helper methods Client-side Event Callbacks ICallBackEventHandler interface Used by TreeView, GridView controls Client Script Goodies 8. XML Databinding control enables data source binding against XML files Optional XPath expression to scope results supports binding against Use “XPath(expression)” statement in templates “XPathSelect(expression)” selects a node list Combine two to build simple RSS Reader RSS Reader 9. URL Rewriting Enable vanity URLs Eliminate ugly query string URLs Simplifies customer navigation experience Possible in ASP.NET 1.1 Required custom code Ex., Community Server ASP.NET 2.0 Simply edit configuration file Add/Remove/Clear mappings URL Rewriting 10. Site Map How to manage all the site urls Many navigation points What is the relationship between these points Possible in ASP.NET 1.1 Write a complete site map Ex., Community Server ASP.NET 2.0 Site Map is a built in feature (Provider based) Makes adding URLs/Pages unbelievably easy Site Map Summary Enormous number of new features in ASP.NET 2.0 Tons of additional cool features out there… Visit http://beta.asp.net/quickstarts to try out hundreds of samples online Download these slides+demos from: http://www.rob-howard.net 10. Dynamic Master Pages Master pages encapsulate layout Enforce a consistent look and feel across pages Master pages can be dynamically chosen Scenario: Per browser type or per customer type Two mechanisms to set dynamically change master: 1) Set Page.MasterPageFile property in Page_PreInit event 2) Device Filter: <%@ page ie:masterpagefile=“ie.master” %> Dynamic MasterPages 10 Localization Whidbey supports nice localization model Store strings and values in a separate .resx file Culture and language settings programmatically and declaratively set Override InitalizeCulture on the Page class <%@ Page UIculture=“value” %> Cool Tip: You can set value to “auto” to have it automatically based on the client browser’s user agent string Localization

Shared by: The Slasher
Other docs by The Slasher
Enron Corp Ammendments and Bylaws
Views: 166  |  Downloads: 1
Employee Settlement and Release Agreement
Views: 410  |  Downloads: 7
Board Resolution Declaring a Regular Dividend
Views: 215  |  Downloads: 4
Call Option Agreement - eBay Inc and iBazar SA
Views: 239  |  Downloads: 10
Form T (Timber) (PDF) Forest Activities Schedule
Views: 240  |  Downloads: 1
TRAVEL ITINERARY
Views: 548  |  Downloads: 46
Audit Release and Settlement
Views: 219  |  Downloads: 4
Company Memorandum Template
Views: 536  |  Downloads: 4
Information release authorization
Views: 310  |  Downloads: 7
The Journal of Abnormal Psychology
Views: 442  |  Downloads: 16
Related docs
ASP.Net Bible
Views: 1317  |  Downloads: 167
A Fast Track Guide to ASP.NET
Views: 88  |  Downloads: 36
Master Pages in ASP.NET 2.0
Views: 632  |  Downloads: 160
ASP.Net 4 all
Views: 33  |  Downloads: 11
Introduction To ASP.NET 2.0
Views: 140  |  Downloads: 29
An Introduction to ASP.NET 2.0
Views: 140  |  Downloads: 45
Better Web Experience with ASP.NET
Views: 411  |  Downloads: 124