ASP.NET Tips To Increase Productivity and Simplify Maintenance – Part 2
ASP.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 building 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 article 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.
Use the Dynamic Data Feature in .NET 3.5 SP1
If 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 SP1
2. Create a new project and select Dynamic Data Web Application from the templates
3. Add a new LINQ to SQL Classes item into your project
4. Open up the Server Explorer, add your target database and drag the desired tables onto the LINQ to SQL designer surface
5. Right-click on Global.asax and select View Code from the menu
6. Locate the model.RegisterContext line in the code file and uncomment it
7. Locate the string “YourDataContextType” here and replace it with the name of your LINQ to SQL data context object. If you named your LINQ to SQL file Northwind, then your data context object will be called NorthwindDataContext
8. Set the ScaffoldAllTables property to true
9. Save the file and run Default.aspx in the browser
10. You now have instant access to insert, update and delete records in your database tables.
No #1 Recommended ASP.NET Hosting
ASPHostPortal.com is the leading provider of Windows hosting and affordable ASP.NET Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability.
HostForLIFE.eu guarantees 99.9% uptime for their professional ASP.NET hosting and actually implements the guarantee in practice. HostForLIFE.eu is the service are excellent and the features of the web hosting plan are even greater than many hosting. HostForLIFE.eu offer IT professionals more advanced features and the latest technology. Relibility, Stability and Performance of servers remain and TOP priority. Even basic service plans are equipped with standard service level agreements for 99.99% uptime. Advanced options raise the bar to 99.99%. HostForLIFE.eu revolutionized hosting with Plesk Control Panel, a Web-based interface that provides customers with 24×7 access to their server and site configuration tools.
DiscountService.com.au is The Best and Cheap ASP.NET Hosting. DiscountService.com.au was established to cater to an under served market in the hosting industry web hosting for customers who want excellent service. DiscountService.com.au guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability. DiscountService.com.au has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch. DiscountService.com.au is devoted to offering the best Windows hosting solution for you.