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  
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

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

    - Develop Your First ASP.NET Website with Visu...
    - Run ASP.NET in Windows XP Home with Cassini ...
    - How to Test a Web Application
    - How to Add Code and Validation Controls to a...
    - Working in Source and Split Views to Build a...
    - How to Build a Web Form for a One-Page Web A...
    - How to Develop a One-Page Web Application
    - An ASP.NET Web Application in Action
    - Developing ASP.NET Web Applications
    - An Introduction to ASP.NET Web Programming
    - Introduction to the ADO.NET Entity Framework...
    - Completing an In-Text Advertising System und...
    - Programming an In-Text Advertising System un...
    - Building an In-Text Advertising System Under...
    - Developing a Mini ASP.NET AJAX Server Centri...





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