ASP.NET
  Home arrow ASP.NET arrow Page 2 - Completing an ASP.NET AJAX Server-Centric ...
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

Completing an ASP.NET AJAX Server-Centric Based Online Shopping Website
By: Xianzhong Zhu
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 9
    2008-02-06

    Table of Contents:
  • Completing an ASP.NET AJAX Server-Centric Based Online Shopping Website
  • Ajaxifying the Operation Module
  • Notification Module
  • Customer/Supplier Functionality Module
  • Loading Foreground Functionality Modules

  • 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


    Completing an ASP.NET AJAX Server-Centric Based Online Shopping Website - Ajaxifying the Operation Module


    (Page 2 of 5 )

     

    Ajaxifying the Operation Module

    The foreground operation module is handled by using the "OperationUC.ascx" UserControl which is responsible for providing common operations to the users, such as logging in, registering, product searching and advanced searching, etc. Figure 40 gives the design-time snapshot of this control.


    Figure 40—the design-time snapshot for the foreground operation module


    First, substantially, an ASP.NET UserControlis very much like a Pageobject, with a great deal of properties and methods that are quite similar. Here, when users click the "Login" button, we’ll use UpdatePanel1to display the login-related information as well as gain the local update effect.

    Second, we’ve still used an ASP.NET AJAX Toolkit TextBoxWatermarkExtendercontrol to gain the watermark effect with the textbox control below the "Searching Keyword" label.

    Third, we’ve leveraged UpdatePanel2to enclose the area inside which lies an ASP.NET Panelcontrol which is used later to load one of the three modules (i.e. AdminOperationUC.ascx, CustomerOperationUC.ascx, and MyOperationUC.ascx) when the users log into the system to also gain the locally updated effect.

    Now, let’s take a look at the initialization of the control.

    protected void Page_Load(object sender, EventArgs e){

    if(Session["UserID"] != null && Session["RoleID"] != null){

    OperationPanel.Controls.Clear();

    if(Session["RoleID"].ToString() == "1") {

    OperationPanel.Controls.Add(Page.LoadControl
    ("~/UserControl/AdminOperationUC.ascx"));

    }

    if(Session["RoleID"].ToString() == "2") {

    OperationPanel.Controls.Add(Page.LoadControl
    ("~/UserControl/CustomerOperationUC.ascx"));

    }

    if(Session["RoleID"].ToString() == "3"){

    OperationPanel.Controls.Add(Page.LoadControl
    ("~/UserControl/MyOperationUC.ascx"));

    }

    }

    if (Session["UserName"] != null) {

    logged.Text = "Welcome:" + Session["UserName"].ToString();

    logged.Visible = true;

    unlogged.Visible = false;

    LogoutBtn.Visible = true;

    LoginBtn.Visible = false;

    }

    }

    As you can see from the code above, this function first judges whether the user has logged into the system, i.e. decides if the value of Session["UserID"]is empty. If the value of Session["UserID"]is not empty, then it means the user has already logged into the system. Therefore, the related module is loaded according to the different role of the user: if the role is "Super Administrator", the "AdminOperationUC.ascx" module is loaded, if it is "Supplier" then "CustomerOperationUC.ascx" and if "Common Customer" then "MyOperationUC.ascx."

    Here since all the buttons related to event handlers are simple to follow up, we will only take a short look at the ShowMessage helper function:

    private void ShowMessage(string sMsg){

    //Response.Write("<script>window.alert('" + sMsg + "')</script>");

    ScriptManager.RegisterStartupScript(Page, GetType(), "MyScript1",

    "alert('" + sMsg +"');", true);

    }

    This function is invoked in the above-mentioned buttons related to event handlers. And as has been discussed in the previous sections, the reason we’ve used the  RegisterStartupScript static member function of the ScriptManager controlinstead of "Response.Write(…)" is because using "Response.Write(…)" during the course of an asynchronous postback will lead to non-execution of the inner script or even a fatal script error.

    Next, let’s shift our attention to the notification module.

    More ASP.NET Articles
    More By Xianzhong Zhu


     

    ASP.NET ARTICLES

    - More Advanced ASP.NET 3.5 Functions and Subr...
    - ASP.NET 3.5 Functions and Subroutines
    - Coding an IQ Test with Conditionally Driven ...
    - Developing Conditionally Driven Event Handle...
    - ASP.NET 3.5 Debugging Using Visual Web Devel...
    - Understanding Event Handlers in ASP.NET 3.5
    - Building a Web Form in ASP.NET and PHP: a Co...
    - Inserting Data into a Microsoft SQL 2008 Dat...
    - Creating an ASP.NET Dynamic Web Page Using M...
    - Retrieving Data from Microsoft SQL Server 20...
    - Building ASP.NET Web Forms to Use a MySQL Da...
    - Creating an ASP.NET Database using MS SQL 20...
    - Building an ASP.NET Website Using Include Ta...
    - Create ASP.NET Web Forms to Use a Microsoft ...
    - Editing Web Design Layout in Visual Web Deve...





    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 10 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek