ASP.NET
  Home arrow ASP.NET arrow Page 5 - ASP.NET Web Forms Weaknesses
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

ASP.NET Web Forms Weaknesses
By: Xianzhong Zhu
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 4
    2008-11-11

    Table of Contents:
  • ASP.NET Web Forms Weaknesses
  • The HTML Tag Weakness
  • Code Explained
  • The JavaScript Weakness
  • Last Example

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    ASP.NET Web Forms Weaknesses - Last Example


    (Page 5 of 5 )


    Well, let's take a look at another sample with a little complication below:

    <%@ Control Language="C#" AutoEventWireup="true" %>

    <asp:TextBox runat="server" ID="textBox" />

    <script language="javascript" type="text/javascript">

    var counter = 0;

    function increase()

    {

    document.getElementById("<%= this.textBox.ClientID %>").value = (counter++);

    window.setTimeout(increase, 500);

    }

    increase();

    </script>

    The above JavaScript code is aimed at adding 1 to a counter every 500 ms, and showing the value of the counter at the TextBox control. However, in a large and complex project, with the JavaScript code on the pages getting more and more complex, we'd better transfer the scripts to individual .js files and refer to them in the pages. As is well known, using individual .js files facilitates code management and improves performance.

    If you put the JavaScript code directly on the pages, every time the page is loaded, it will need to download these JavaScript codes. The .js files can be buffered, so that they only need to load one time. The script files can be utilized again and again, which decreases the communication between the client side and the server side so that loading speed is increased and performance is improved.

    Now here is the issue. To correctly refer to the DOM element generated by the Server Control at the page, we have to use the <%= %> mark to output the property ClientID. However, the <%= %> mark can not be used inside the .js file! This example represents another kind of "client-side ID pollution" caused by using WebForms.

    So, what should we do with the above puzzle? The answer is to only extract the invariable parts into .js files while leaving the variable parts (such as the client-side ID of the server control) on the page. Also, another typical solution to this is to use the Component technique, a good example of which is the ASP.NET AJAX Control Toolkit Extenders. For brevity, I won't list related code examples; you can check these out yourself. 

    Over a period of time, the Rails framework has become popular, especially with the combination known as Ruby On Rails. So, within the .NET community there also appeared a Monorail, and the voices criticizing Web Forms have become louder and louder. With Microsoft itself producing the new ASP.NET MVC framework, Web Forms critics become even more critical. Well, will Web Forms quit the stage and become obsolete? Let's look more closely into the ASP.NET MVC framework and find out the answer.

    Before making comments on ASP.NET MVC architecture, it's necessary to say a few words about it. We will begin to cover it in the next part of this four-part series.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · Excellent article! Ive been complaining about WebForms to senior C# people for years...
     

    ASP.NET ARTICLES

    - Develop Your First ASP.NET Website with Visu...
    - Run ASP.NET in Windows XP Home with Cassini ...
    - How to Test a Web Application
    - How to Add Code and Validation Controls to a...
    - Working in Source and Split Views to Build a...
    - How to Build a Web Form for a One-Page Web A...
    - How to Develop a One-Page Web Application
    - An ASP.NET Web Application in Action
    - Developing ASP.NET Web Applications
    - An Introduction to ASP.NET Web Programming
    - Introduction to the ADO.NET Entity Framework...
    - Completing an In-Text Advertising System und...
    - Programming an In-Text Advertising System un...
    - Building an In-Text Advertising System Under...
    - Developing a Mini ASP.NET AJAX Server Centri...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    Stay green...Green IT