ASP.NET
  Home arrow ASP.NET arrow Page 5 - Developing a Dice Game Using ASP.NET Futur...
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

Developing a Dice Game Using ASP.NET Futures Drag and Drop Techniques
By: Xianzhong Zhu
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 10
    2008-04-09

    Table of Contents:
  • Developing a Dice Game Using ASP.NET Futures Drag and Drop Techniques
  • Defining the two behaviors: MagicDragSourceBehavior and MagicDropTargetBehavior
  • MagicDropTargetBehavior
  • HTML code-related programming
  • XML-Script programming
  • JavaScript programming

  • 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


    Developing a Dice Game Using ASP.NET Futures Drag and Drop Techniques - XML-Script programming


    (Page 5 of 6 )

    Now let’s see the xml-script code related to this dice game, which is shown in the following:

    <script type="text/xml-script">

    <page xmlns:script="http://schemas.microsoft.com/xml-script/2005"

    xmlns:cns="javascript:Custom.UI">

    <components>

    <control id="DragSource1">

    <behaviors>

    <cns:MagicDragSourceBehavior id="b1" />

    </behaviors>

    </control>

    <control id="DragSource12">

    <behaviors>

    <cns:MagicDragSourceBehavior id="b2" />

    </behaviors>

    </control>

    <control id="DragSource3">

    <behaviors>

    <cns:MagicDragSourceBehavior id="b3"/>

    </behaviors>

    </control>

    <control id="DragSource4">

    <behaviors>

    <cns:MagicDragSourceBehavior id="b4" />

    </behaviors>

    </control>

    <control id="DragSource5">

    <behaviors>

    <cns:MagicDragSourceBehavior id="b5"/>

    </behaviors>

    </control>

    <control id="DragSource6">

    <behaviors>

    <cns:MagicDragSourceBehavior id="b6" />

    </behaviors>

    </control>

     

     

    <control id="DropTarget">

    <behaviors>

    <cns:MagicDropTargetBehavior/>

    </behaviors>

    </control>

    <Button id="restartBtn" click="btnClickHandler"/>

    </components>

    </page>

    </script>

    Since the two custom behaviors we are to use are defined in the Custom.UI custom namespace, we have to add a reference to this namespace.

    xmlns:cns="javascript:Custom.UI">

    Next, we defined six ASP.NET AJAX client-side controls, which are bound to the six <div/> DOM elements that represent the six dice respectively. And, as is discussed above, we should apply the custom MagicDragSourceBehavior to all six controls.

    Inside the descriptor block of MagicDragSourceBehavior, we’ve merely exposed one property—dragDropMagic. This property is a rather complex object. Therefore, we decide to use the JavaScript mode, rather than the xml-script mode, to specify this property for the six behaviors (which should be discussed later).

    Next, the DOM element <div/> that represents the drop area is also attached to a client-side control (DropTarget), which is also decorated with another MagicDropTargetBehavior.

    In the next section we'll see how we use the JavaScript mode to specify the dragDropMagic property for the above six behaviors and how we can attach a click event handler to the ‘Restart the game’ button.

    More ASP.NET Articles
    More By Xianzhong Zhu


     

    ASP.NET ARTICLES

    - 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
    - Building a Simple Storefront with LINQ





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