ASP.NET
  Home arrow ASP.NET arrow Page 5 - Delving Deeper into Drag and Drop Programm...
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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
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

Delving Deeper into Drag and Drop Programming in Microsoft ASP.NET AJAX
By: Xianzhong Zhu
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2007-06-25

    Table of Contents:
  • Delving Deeper into Drag and Drop Programming in Microsoft ASP.NET AJAX
  • Write a Behavior: ShoppingCartBehavior to make the shopping cart droppable
  • Coding the web page
  • Obtaining the list of the pets to sell via Web Service
  • Dealing with the order via Web Service

  • 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


    Delving Deeper into Drag and Drop Programming in Microsoft ASP.NET AJAX - Dealing with the order via Web Service


    (Page 5 of 5 )

    When the customer finally clicks the Order button near the shopping cart, he can see a message showing the data result he cares about within a red rectangle below the shopping cart area. This is accomplished by asynchronously posting back the current information about the pets to buy that needs to be processed to the server side. The following code corresponds to the click event handler of the Order button:

     

    function btnOrder_onclick() {

      //get behavior ShoppingCartBehavior attached to the shopping cart

      var shoppingCartBehavior = Sys.UI.Behavior.getBehaviorByName(

        $get("shoppingCart"),

        "myShoppingCartBehavior"

      );

     

      //Get the Id and quantity of each pet in the shopping cart

      var productsToBeOrdered =

        shoppingCartBehavior.getProductsToBeOrdered();

     

      //Call Web Service to deal with the order

      ShoppingService.Order(productsToBeOrdered, onOrdered);

    }

     

    As is seen from above, we first use the Sys.UI.Behavior.getBehaviorByName() method to get the behavior-ShoppingCartBehavior that is attached to the shopping cart, then obtain the Id and quantity of each pet in the shopping cart, and finally post this information back to the Web Service to be processed.

    Here, still for demonstration purposes, in the call back function productsToBeOrdered() we've used an HTML element div to display the response from the server to the user:

     

    function onOrdered(result) {

      OutputMsg.innerHTML=result;}

     

    So much for this sample; you can press F5 and give it a test! I bet you will be attracted by the friendly interface.

    Final Thoughts

    In this article, we first briefly compared most of the drag and drop solutions supplied by the MS AJAX framework, then summed up the inner workings of the drag and drop mechanism on the client side. After that, we focused on the client-side interfaces IDragSouce and IDropTarget, and also the DragDropManager and gave an integrated and complex example. Finally, we should notice that the MS AJAX framework has been undergoing rapid and great changes day after day; thus, only by keeping up with the changes can we web developers create the most professional, attractive and cross-browser compatible web applications.


    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.

       · Whats ironic is I just recently created a drag/drop DLL control or a customer and...
       · Hi, I'm very glad to hear that and would like to be notified. In fact, the current...
       · Hey guys, many tnx for the examples - beginners like me can get the right impuls to...
       · Thanks a lot for showing the path to ajax - specials.Latawiec
       · You're welcome. Remember that I'm just a newbie for MS AJAX (only for 6 months in...
     

    ASP.NET ARTICLES

    - Developing a Mini ASP.NET AJAX Server Centri...
    - Disadvantages of the ASP.NET MVC Framework
    - Advantages of the ASP.NET MVC Approach
    - ASP.NET Web Forms Weaknesses
    - ASP.NET Web Forms Meets ASP.NET MVC
    - Source Code for Saving and Retrieving Data w...
    - Using GridView to Save and Retrieve Data wit...
    - Handling Dynamic Images in ASP.NET 3.5 AJAX ...
    - Retrieving Data with AJAX and the GridView C...
    - Playing with Images in ASP.NET 3.5 AJAX Appl...
    - Saving and Retrieving Data with AJAX
    - Enhancing PHP Via the ASP.NET AJAX Framework...
    - Enhancing PHP Programming with the ASP.NET A...
    - Classes and ASP.NET AJAX
    - Using ASP.NET AJAX

     
    Best Practices for Windows Vista Migration Presentation
    Dell and Microsoft recently held a series of face-to-face seminars entitled, &qu....

     
    Creating a Culture for Code Reuse
    If you oversee development teams you know that like it or not proprietary and ex....

     
    Keys to Web Application Acceleration: Advances in Delivery Systems
    Accelerate Web apps by up to 5x. Ensure significantly faster access to the Web a....

     
    Optimizing Application Monitoring
    Tired of finding out from your customers that you're offline? This white paper e....

     
    Solaris to Solaris Migration -- Migrating applications from Sun SPARC to Dell PowerEdge R900
    This comprehensive Migration Guide reviews the approach that Principled Technolo....

     




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