ASP.Net Client Side

Discussion in 'ASP.NET' started by MinalS, Jul 19, 2015.

  1. The static web page does not respond to the actions performed by the user. The dynamic web page is useful for responding to the web pages. The applications are created using client side scripts along with the HTML pages.

    The client side coding contains two points as mentioned below:
    1. Client side source code: The source of HTML consists of ASP.NET web pages. There are hidden fields which insert the JavaScript code blocks automatically. The data about the view state is stored.
    2. Client side scripts: They are executed on the web browser. The speed of the page execution is increased. The validation at client side checks for the invalid data and alerts the user about the information.

    Client side scripts



    The ASP.NET server controls helps user to create web pages which are used for dynamically responding to the inputs provided by the user. It does not communicate with the web server.

    The client side script reduces the network traffic. The dynamic response is provided as it does not interact with the server. The response time of the web application is increased.

    Limitations of client side scripts
    1. The client side scripts do not access the resources at server end. Much more coding is needed for file access and database interaction.
    2. The scripting is not supported by all the browsers and the operating system.
    3. The Web enabled devices like laptop, mobile, Personal Digital Assistance do not support the client side scripting.
    4. The scripting at client end is easily visible to the end users.
    Some of the events which can execute a script are as listed.
    1. onserverclick: The ServerClick event is raised when the control is clicked
    2. onkeyup: When the user releases the key, the event is raised
    3. onmouseover: The mouse pointer moves over the control, the event is raised
    4. onclick: Once user clicks the control, the corresponding event is raised
    5. onkeypress: When the alphanumeric key is pressed, the event is fired
    6. onfocus: Once the control acquires the focus, the event is rasied
    7. onblur: When the control losses the focus, the event is fired
    8. onchange: Once the value of the control modifies, the event is raised.

    Client side source code



    The ASP.NET application code is written in two files as code behind file and the content or markup file. The code behind file consists of the class definition. The content file contains of ASP.NET and HTML control tags. The content file is parsed at the content is transferred into a page class.

    The combination of code file and the code generated by the system make an executable code. It is used for processing the data, create responses, and send the reply back to the client.

    The following code shows the client side source code in an application.

    Code:
    
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehindFile="Defautl.aspx.cs" Inherits="_Default" %>
    
    <!DOCTYPE html PUBLIC "-//W3C/DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server" >
        <title></title>
    </head>
    
    <body>
        <form id="form1" runat="server">
        <div>
    
        <asp:Label ID="label1" runat="server"></asp:Label>
        <asp:TextBox ID="text1" runat="server"></asp:TextBox>
        <br/>
    
        <asp:Button ID="btn1" runat="server" Text="Show" OnClick="btn1_Click" />
        </div>
        </form>
    </body>
    </html>
    
    
    Execute the web page on the browser, click View Source option. The HTML page is sent to the browser by ASP.NET runtime.

    Code:
    
    <!DOCTYPE html PUBLIC "-//W3C/DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head><title>
    
    </title></head>
    <body>
        <form method="post" action="Default.aspx" id="form1">
        <div class="aspNetHidden">
        <input type="hidden" name="_VIEWSTATE" id="_VIEWSTATE" value="/wEPDwULLTEzMTc4NjY3NThkZkgTOGe/IyKAnFn5N8Z2vheErDZi9OLOnp5k4y+r1UNx" />
        </div>
    
        <div class="aspNETHidden">
        
        <input type="hidden" name="_EVENTVALIDATION" id="_EVENTVALIDATION" value="/wEWAwkbj6/GBwKTjKGwCgKSotaIC25xAlZpUSBdmZ09k3y5KrxugYfWG0SngcRPHwjfXSxQ" />
        </div>
    
        <div>
        <span id="label1"></span>
        <input name="text1" type="text" id="text1" />
        <br/>
    
        <input type="submit" name="btn1" value="Show" id="btn1" />
        </div>
        </form>
    </body>
    </html>
    
     
    shabbir likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice