ASP.NET
  Home arrow ASP.NET arrow Page 3 - Completing an ASP.NET AJAX Client-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  
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

Completing an ASP.NET AJAX Client-Centric Wiki Application
By: Xianzhong Zhu
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2007-10-16

    Table of Contents:
  • Completing an ASP.NET AJAX Client-Centric Wiki Application
  • The Server Side
  • Write a Post Related to the Special Article
  • Summary

  • 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 Client-Centric Wiki Application - Write a Post Related to the Special Article


    (Page 3 of 4 )

    As is pointed out, there are a lot of puzzles and awkwardness to tackle in dealing with the XML typed data using a Microsoft AJAX client-centric scheme. Therefore, here, we still have to resort to the original AJAX mode when adding posts (which will be persisted in the '.xml' file form) to the present article.

    Now, when you click the Reply hyperlink at the ContentList.aspx page, you will be redirected to another page named ReplyMsg.aspx. The following Figure 13 corresponds to it as a design-time snapshot.

    Figure 13-the design-time snapshot when replying to the current article.

    Whether the inner logic or the user interface design, this part is quite similar to the above 'Writing a New Article Using......'. Therefore, we will make a long story short. The above Reply hyperlink corresponds to the following HTML code:

    <div >

    <a id='btnReply' href="javascript:backdata()" title="Reply the
    post">

    <img src="images/reply.PNG" />

    </a>

    </div>

    Obviously, all the secrets are wrapped in the JavaScript function backdata:

    function backdata(){

      document.getElementById("hintMsg").innerHTML="Posting Data...";

       var filename=getParm();

       var title=document.getElementById("txttitle").value;

       var content=document.getElementById("txtcontent").value;

     createHTTP();

      xmlhttp.onreadystatechange=stateChange;

      xmlhttp.open("POST","ReplyMsgServer.aspx?filename="+
    filename+"&title="+escape(title)+"&content="+escape
    (content),true);

      xmlhttp.send(null);

    }

    As is seen from above, all the coding here exactly resembles the coding we did for posting a new article.

    Next, let's take a look at the server side programming within the  'ReplyMsgServer.aspx.cs' file (the so-called 'CGI'). As usual, we first give the related code snippet, as follows:

    protected void Page_Load(object sender, EventArgs e){

      ArticleManager manager = new ArticleManager();

       string filename = Server.MapPath(".") + @"" +
    Request.QueryString["filename"] + "file.xml";

      manager.UpdateXmlFile(filename, Request.QueryString["title"],

    Request.QueryString["content"],
    HttpContext.Current.User.Identity.Name);

    manager.UpdateDatabase(int.Parse(Request.QueryString
    ["filename"]));

      Response.Write("");

    }

    There are still four tasks to perform:

    1. Accept the passed parameters and rebuild a file name with full path. 
    2. Update the corresponding '.xml' file that holds the detailed article content. 
    3. Update the general article information into the database table. 
    4. Post back to the client side the message about the asynchronous invocation. All the contents relevant to the UpdateXmlFile() and UpdateDatabase() functions are nearly the same as those in the above AddXML() and AddArticle() functions.

    Here, still for the sake of brevity, we omit all of them. However, there turns up a peculiar bug here that I have to mention. If we, as usual, replace the above last sentence with the following:

    Response.Write("The asynchronous invocation is successful!");

    I will see some messy content (beginning with this above specified hint message) at the bottom of the above Figure 13. To my astonishment, anything else is still OK-we can , as usual, see the recently-posted contents when we again launch the web application! For this reason, I have to post an empty string to the client side. If anyone e is successful in overcoming this bug, I would be very glad to hear about it. 

    Oh, so much is for this long and mildly awkward application. You can finally press F5 and give it a test!

    More ASP.NET Articles
    More By Xianzhong Zhu


     

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