Find White Papers
Home
About Us
List Your Papers
    
> Global Knowledge > 10 ASP.NET Tips To Increase Productivity and Simplify Maintenance

10 ASP.NET Tips To Increase Productivity and Simplify Maintenance

White Paper Published By: Global Knowledge

Five Things About Windows Server 2008 You Might Not Know



Tags : 
asp, asp.net, increase, productivity, simplify, maintenance, asp.net 2.0, tip

Global Knowledge
Published:  Jun 16, 2009
Type:  White Paper
Length:  17 pages

Expert Reference Series of White Papers
10 ASP.NET Tips To
Increase Productivity
and Simplify
Maintenance
1-800-COURSES www.globalknowledge.com10 ASP.NET Tips To Increase
Productivity and Simplify Maintenance
Dan Wahlin, Microsoft MVP, ASP Insider, Silverlight Insider, MCT, MCAD
IntroductionASP.NET provides a robust framework for building Web applications that minimizes the amount of code that's required to be written. Although most developers rely on Visual Studio or Web Developer Express when build-ing applications, there's no substitute for knowing the framework when it comes to increasing productivity. The more you know about built-in functionality in the .NET framework and ASP.NET, the less code you have to write, which ultimately makes your applications more maintainable.
This white paper outlines several different tips to enhance developer productivity and reduce the amount of code that needs to be written in many cases. Tips range from simple concepts, such as setting default focus on a control to creating your own FindControl() method. Although the tips focus on ASP.NET Web Forms, there is also information about Microsoft's latest ASP.NET MVC framework as well. Let's get started.
Tip #1 - Strongly Typed Access to Cross-Page Postback
ControlsASP.NET 2.0 and higher supports the ability to post data from one page to another using cross-page postback functionality. This is useful when you don't want a page to postback to itself. For example, you may have a search user control defined in a master page, and when the end user searches, you want to take them to a search results page.
The built-in cross-page postback functionality in ASP.NET works great out of the box but doesn't provide strongly-typed access to controls in the previous page. Out of the box, you'll normally have to resort to FindCon-trol() method calls to locate the controls. There's another option that can be used, though, to access controls in a strongly-typed manner, which minimizes the amount of strings in your code and allows the compiler to catch errors more easily.
If you have a page called Default.aspx that exposes a public property that returns a Textbox defined in the page, the page that data is posted to (let's call it SearchResults.aspx) can access the property in a strongly-typed man-ner by adding the PreviousPageType directive into the top of the page:
<%@ PreviousPageType VirtualPath="Default.aspx" %>
Copyright ©2009 Global Knowledge Training LLC. All rights reserved. 2By adding this directive, the code in SearchResults.aspx can access the TextBox defined in Default.aspx in a strongly-typed manner. The following example assumes the property defined in Default.aspx is named Search-TextBox.
C# TextBox tb = PreviousPage.SearchTextBox;
Visual BasicDim tb as TextBox = PreviousPage.SearchTextBox
This code obviously only works if the previous page is Default.aspx. PreviousPageType also has a TypeName property as well where you can define a base type that one or more pages derive from to make this technique work with multiple pages.
Tip #2 - Use the Dynamic Data Feature in .NET 3.5 SP1If you've ever had to create database admin pages by hand, you know that it can be a time-consuming process. By using built-in controls such as SqlDataSource or ObjectDataSource, you can certainly simplify the process, but creating the pages and hooking the data to the controls still takes time. Visual Studio 2008 with SP1 installed adds a new project type into the mix called Dynamic Data that can be used to automatically create insert, up-date and delete pages to modify data in a database. Dynamic Data is very customizable but even out of the box, it gives you a great deal of functionality.
Here are the basic steps to get started using Dynamic Data.1. Install .NET 3.5 SP1 and Visual Studio 2008 SP12. Create a new project and select Dynamic Data Web Application from the templates3. Add a new LINQ to SQL Classes item into your project4. O pen up the Server Explorer, add your target database and drag the desired tables onto the LINQ to SQL designer surface5. Right-click on Global.asax and select View Code from the menu6. Locate the model.RegisterContext line in the code file and uncomment it7. L ocate the string "YourDataContextType" here and replace it with the name of your LINQ to SQL data context object. I... [download for more]

Browse Technology Topics

Data Center

Virtualization, Cloud Computing, Infrastructure, Design and Facilities, Power and Cooling, Green Computing  
    

Data Management

Application Integration, Analytical Applications, Business Intelligence, Configuration Management, Database Development, Data Integration, Data Mining, Data Protection, Data Quality, Data Replication, Database Security, EDI, SOAP, Service Oriented Architecture, Web Service Management, Data Warehousing  
    

Enterprise Applications

Application Integration, Application Performance Management, Best Practices, Business Activity Monitoring, Business Analytics, Business Integration, Business Intelligence, Business Management, Business Metrics, Business Process Automation, Business Process Management, Call Center Management, Call Center Software, Change Management, Corporate Governance, Customer Interaction Service, Customer Relationship Management, Customer Satisfaction, Customer Service, EBusiness, Enterprise Resource Planning, Enterprise Software, EProcurement, Extranets, Groupware Workflow, HIPAA Compliance, IP Faxing, IT Spending, Marketing Automation, Performance Testing, Product Lifecycle Management, Project Management, Return On Investment, Risk Management, Sales & Marketing Software, Sales Automation, Server Virtualization, Simulation Software, Supply Chain Management, System Management Software, Total Cost of Ownership, Video Conferencing, Voice Recognition, Voice Over IP, Workforce Management, Incentive Compensation, Spend Management, Manufacturing Execution Systems, International Computing  

Human Resource Technology

Human Resources Services, Payroll Software, Time and Attendance Software, Workforce Management Software, Financial Management, Employee Monitoring Software, Employee Training Software, Recruiting Software/Services, Employee Performance Management, ELearning, Benefits Management, Expense Management  
    

IT Career Advancement

Cisco Certification, Microsoft Certification, Linux Certification, Network Security Certification, Software Development Certification  

IT Management

Employee Performance, ITIL, Productivity, Project Management, Software Compliance, Sarbanes Oxley Compliance, Service Management, Desktop Management  
    

Knowledge Management

Collaboration, Collaborative Commerce, Contact Management, Content Delivery, Content Integration, Content Management System, Corporate Portals, Customer Experience Management, Document Management, Information Management, Intranets, Messaging, Records Management, Search And Retrieval, Search Engines, Secure Content Management, SLA  

Networking

Active Directory, Bandwidth Management, Convergence, Distributed Computing, Ethernet Networking, Fibre Channel, Gigabit Networking, Governance, Grid Computing, Infrastructure, Internetworking Hardware, Interoperability, IP Networks, IP Telephony, Local Area Networking, Load Balancing, Migration, Monitoring, Network Architecture, Network Management, Network Performance, Network Performance Management, Network Provisioning, Network Security, OLAP, Optical Networking, Quality Of Service, Remote Access, Remote Network Management, Server Hardware, Servers, Small Business Networks, TCP/IP Protocol, Test And Measurement, Traffic Management, Tunneling, Utility Computing, VPN, Wide Area Networks, Green Computing, Cloud Computing, Power and Cooling, Data Center Design and Management, Colocation and Web Hosting  
    

Platforms

AS/400, Domino, Linux, Microsoft Exchange, Oracle, PeopleSoft, SAP, Siebel, Solaris, Tivoli, Unix, Web Sphere, Windows, Windows Server  

Security

Access Control, Anti Spam, Anti Spyware, Anti Virus, Application Security, Auditing, Authentication, Biometrics, Business Continuity, Compliance, DDoS, Disaster Recovery, Email Security, Encryption, Firewalls, Hacker Detection, High Availability, Identity Management, Internet Security, Intrusion Detection, Intrusion Prevention, IPSec, Network Security Appliance, Password Management, Patch Management, Phishing, PKI, Policy Based Management, Security Management, Security Policies, Single Sign On, SSL, Secure Instant Messaging, Web Service Security, PCI Compliance, Vulnerability Management  
    

Software Development

.NET, C++, Database Development, Java, Middleware, Open Source, Software Outsourcing, Quality Assurance, Scripting, SOAP, Software Testing, Visual Basic, Web Development, Web Services, Web Service Security, XML  

Storage

Backup And Recovery, Blade Servers, Clustering, IP Storage, ISCSI, Network Attached Storage, RAID, Storage Area Networks, Storage Management, Storage Virtualization, Email Archiving, Data Deduplication  
    

Wireless

802.11, Bluetooth, CDMA, GPS, Mobile Computing, Mobile Data Systems, Mobile Workers, PDA, RFID, Smart Phones, WiFi, Wireless Application Software, Wireless Communications, Wireless Hardware, Wireless Infrastructure, Wireless Messaging, Wireless Phones, Wireless Security, Wireless Service Providers, WLAN  
Search