| By Bill Rogers | Article Rating: |
|
| October 3, 2005 02:30 AM EDT | Reads: |
22,781 |
Since the introduction of CGI in 1993, the Web has become an increasingly popular medium for interactive content and application development. The evolution of Web programming has come a long way in 12 years, and new technologies are being introduced on an almost daily basis. As a developer, it can be difficult to determine which new technologies are worth implementing and which should just be left alone.
New technologies afford us new opportunities to make better, more powerful Web applications. The demand for more functionality on Web sites is becoming greater and users now expect Web applications to run more like desktop applications. Web users are becoming dissatisfied with sites that just present a mass of information for them to browse through. They want to have searching, ability to provide feedback, and rating systems. They want ways to interact with the Web; they don't want to just be passive observers.
These new technologies can also help developers become more efficient. Faced with the challenge of reduced IT budgets, smaller teams, and compressed schedules to roll out new Internet and intranet sites and rich Web applications, developers need every advantage tilted in their favor to help their organizational Web strategies succeed. By leveraging the potential of the .NET framework, developers can both improve Web application functionality and take advantage of its object-oriented architecture to streamline and accelerate the development process. This article explains three key features of ASP.NET that you can implement to improve your development team's Web strategy.
Web Sites vs. Web Apps
Developers are quick to use the term Web application to describe just about any project they put on the Web. A Web site isn't a Web application just because it has some dynamic content or a few basic scripts; the term "application" implies a certain amount of interactivity. For example, many news sites contain huge amounts of dynamic information, but they often lack the interaction necessary to consider them Web applications. The content on the site may be managed with a Web app, but the user really doesn't notice any difference between a site with manually added information and one with a content management system. To become an application, it needs to be more than just a collection of static files.
The news site could become a Web application with some additions. Add some searching and indexing features, allow users to create personalized home pages, or create a system for them to give feedback and the site begins to become an application. Users want Web applications that function like their desktop applications. We now have the technology to add these interactive features that people expect from the sites they visit.
The .NET framework allows Web developers to bring many of these desktop application elements into their Web sites. Many might argue that ASP, PHP, and other Web scripting languages can offer the same functionality, but ASP.NET provides not only a more powerful object-oriented environment, but it also helps developers to work more efficiently. Web services also help .NET connect with other Web and desktop applications.
Using Visual Studio .NET
There is a wide variety of Web development applications in use today that range from simple text editors to full featured WYSIWYG applications such as DreamWeaver. Chances are if you're not already creating ASP.NET sites, you're not using Visual Studio .NET. However, Visual Studio offers a lot of features that will make developing in ASP.NET much easier.
The first and most obvious advantage of developing in Visual Studio over DreamWeaver or another WYSIWYG is the built-in compiler. When developing in Visual Studio you can build the entire project with a few shortcut keys, whereas in most other applications you have to use an external compiler, which can be a nightmare when debugging. Visual Studio also has code hinting and drag-and-drop functionality for server controls, which definitely help speed things up.
One downside to Visual Studio is its limited WYSIWYG functionality. Visual Studio was built to be a .NET IDE, not a Web design application, so in comparison to Hot Metal and DreamWeaver it's pretty awkward for writing HTML. If you do a significant amount of design or HTML coding, you will likely want to do the majority of your HTML and JavaScript work in whatever application you're currently using for design and use Visual Studio to program.
Developing with Server Controls
If you're familiar with VB.NET or C#, you're probably already familiar with most of the server controls you see in ASP.NET. Server controls are a great feature of ASP.NET because they help reduce code volume and make development a lot more efficient if used well. These controls incorporate both visual and functional elements that are common in Web development such as form elements and validation functions. You can also combine or modify preexisting controls into reusable custom controls.
Let's go over a brief example of a simple Web form with some server controls in it. There are a few things you should notice about the page overall. All of the server controls have the runat="server" attribute; this is required for any elements that will be used by ASP.NET. Each of the controls also needs a unique ID that allows you to reference the control with VB or C#.
The form in Listing 1 has three server controls and two sub routines to handle events from the server controls. Line 17 is a label server control that outputs a span tag that can be used to display messages to the browser.
Line 18 contains a text box control. The text box control outputs a text input to the browser and incorporates some great functionality that would normally require a fair amount of JavaScript. The OnTextChanged attribute assigns an event handler to be run when the text in the text input changes. The AutoPostBack attribute causes the form to automatically post when changes are made. These two attributes allow you to detect if text has been changed and automatically run the appropriate event handler with only one line of code. Line 19 contains a list box control that has very similar attributes to the text box control. Again, the control detects when a change has been made and automatically posts to the server and runs the appropriate event handler.
Now let's take a quick look at the event handlers. You'll notice that the text property is referenced on all three of the server controls - on line 6 for the text box and label controls, and on line 10 for the list box control. The built-in server controls often share these common properties, thereby making it very easy to exchange one for another. For example, changing a radio button to a check box would require only one line of code to be changed.
User Controls
User controls are files that can contain both visual and functional elements and can be used just like the built-server controls. They allow you to combine existing server controls, HTML, and VB or C# code into a reusable control. Some common user controls include login forms, calculators, or display elements. Let's look at an example user control and how it is implemented in the site.
Published October 3, 2005 Reads 22,781
Copyright © 2005 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Bill Rogers
Bill Rogers is founder and CEO of Ektron, Inc (www.ektron.com). Founded in 1998, Ektron has nearly 15,000 customer integrations worldwide.
- iPad3 vs Windows 8 - and the Winner Is...Cloud
- Eleven Reasons Why Windows Phone Will Overtake Android
- Windows Azure Overview Part 4: Security
- Agile Development & Enterprise Architecture Practice – Can They Coexist?
- Eleven Tips for Successful Cloud Computing Adoption
- GM to Pull Facebook Advertising: WSJ
- System Center Virtual Machine Manager 2012 as Private Cloud Enabler
- Apply Agile When Deploying Apps
- The Web – Changing the Way We Work
- EE Times and EDN Announce the 2012 UBM Electronics ACE Award Winners
- Closer Look at One NoSQL Database – MongoDB
- Why Is Scrum So Widely Adopted and So Very Dangerously Deceptive
- iPad3 vs Windows 8 - and the Winner Is...Cloud
- Cisco Unveils Visual Collaboration Solutions in the Post-PC Era, Extending the Reach of TelePresence With New Mobile-to-Immersive Offerings
- Eleven Reasons Why Windows Phone Will Overtake Android
- Windows Azure Overview Part 4: Security
- Agile Development & Enterprise Architecture Practice – Can They Coexist?
- Eleven Tips for Successful Cloud Computing Adoption
- GM to Pull Facebook Advertising: WSJ
- System Center Virtual Machine Manager 2012 as Private Cloud Enabler
- Apply Agile When Deploying Apps
- The Web – Changing the Way We Work
- Book Review: Decision Management Systems
- User Group Malaise?
- Google Maps and ASP.NET
- Converting VB6 to VB.NET, Part I
- How to Write High-Performance C# Code
- Crystal Reports XI & How It Has Changed
- Creating Controls for.NET Compact Framework in Visual Studio 2005
- Where Are RIA Technologies Headed in 2008?
- Programmatically Posting Data to ASP .NET Web Applications
- Implementing Tab Navigation with ASP.NET 2.0
- AJAX World RIA Conference & Expo Kicks Off in New York City
- i-Technology Viewpoint: "SOA Sucks"
- .NET Archives: Getting Reacquainted with the Father of C#
- i-Technology Photo Exclusive: Bill Gates & Steve Jobs In "Nerds"




















