ASP.NET
  Home arrow ASP.NET arrow Page 4 - 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 - HTML code-related programming


    (Page 4 of 6 )

    Open the CustDragDropDemo.aspx page. As with other typical ASP.NET AJAX web pages, at the nearest position neighboring <form> element, we can see the definition of the ASP.NET AJAX server control ScriptManager; within which, we should add all necessary references to the related script files. Here’s the corresponding code:

    <asp:ScriptManager ID="ScriptManager1" runat="server">

    <Scripts>

    <asp:ScriptReference Assembly="Microsoft.Web.Preview"

    Name="PreviewScript.js" />

    <asp:ScriptReference Assembly="Microsoft.Web.Preview"

    Name="PreviewDragDrop.js" />

    <asp:ScriptReference Path="~/Scripts/custDragDrop.js" />

    </Scripts>

    </asp:ScriptManager>

    As was shown before, in the custDragDrop.js file we defined two custom behaviors, MagicDragSourceBehavior and MagicDropTargetBehavior, and an important class, Custom.UI.DragDropMagic, which represents the factual data the draggable object carries.

    Next, follow the relatedHTMLelement definitions and use someCSSstyles for a beautiful look. That’s all.

    <fieldset style="width: 607px" >

    <legend><span style="font-size: 12pt">Please select a dice</span></legend>

    <table cellpadding="8">

    <tr>

    <!-- Drag sources -->

    <td style="height: 80px">

    <div id="DragSource1" class="magicBack" />

    </td>

    <td style="height: 80px">

    <div id="DragSource12" class="magicBack" />

    </td>

    <td style="height: 80px">

    <div id="DragSource3" class="magicBack" />

    </td>

    <td style="height: 80px">

    <div id="DragSource4" class="magicBack" />

    </td>

    <td style="height: 80px">

    <div id="DragSource5" class="magicBack" />

    </td>

    <td style="height: 80px">

    <div id="DragSource6" class="magicBack" />

    </td>

    </tr>

    </table>

    </fieldset>

    <div style="width: 67%; height:80px; margin: 5px;">

    <input id="restartBtn" type="button" value="Restart the game" style="width: 90px; height: 34px" />

    </div>

    <fieldset style="width: 264px; height: 245px">

    <legend><span style="font-size: 12pt">Drop the dice here</span></legend>

    <!-- Drop target -->

    <div id="DropTarget" class="divDropTarget">

    ?

    </div>

    </fieldset>

    Note here that we have used <fieldset> elements to lay out the page. As for the CSS style definitions, you can refer to the source code.

    Next, let’s pay attention to the ASP.NET AJAX client side specific declarative XML-Script programming.

    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 4 hosted by Hostway
    Stay green...Green IT