|
Comments
|
Today's Top SOA Links
ASP.NET Bring Windows to the Web: Bringing Desktop Apps to Your Web Sites
As .NET 2.0 approaches, which new technologies are worth implementing?
By: Bill Rogers
Oct. 3, 2005 02:30 AM
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 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 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 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 Reader Feedback: Page 1 of 1
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
|
SYS-CON Featured Whitepapers
Most Read This Week |
|||||||||||||||||||||||||||