ASP.NET
  Home arrow ASP.NET arrow Handling Articles and Categories for an AS...
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

Handling Articles and Categories for 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-15

    Table of Contents:
  • Handling Articles and Categories for an ASP.NET AJAX Client-Centric Wiki Application
  • Display the Article Categories
  • Display an Article Asynchronously
  • Why is it More Challenging?

  • 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


    Handling Articles and Categories for an ASP.NET AJAX Client-Centric Wiki Application


    (Page 1 of 4 )

    In the first two articles in this series, we began building an ASP.NET client-centric wiki application. We left off with the user interface. In this article, the third one in a four-part series, we continue looking at the user interface, with a special focus on the article categories.
    A downloadable .rar file is available for this article.

    Web Service and Database

    First, let’s look at the definition of the Web Service—MyDataService:

      using System.Data;

       using System.Web.Script.Services;

       using Microsoft.Web.Preview.Services;

       using Demos.CategoryInfo;

    …… (Omitted)

    [ScriptService]

    public class MyDataService : DataService{

    [WebMethod]

    [DataObjectMethod(DataObjectMethodType.Delete)]

    public void DeleteRecord(CategoryInfo o){

      if (o.CategoryName == null)

        {throw new AccessViolationException();}

         new SqlTaskProvider().DeleteRecord(o);

    }

    [WebMethod]

    [DataObjectMethod(DataObjectMethodType.Select)]

    public List<CategoryInfo> GetAllRecords()

      { return new SqlTaskProvider().GetAllRecords();}

    [WebMethod]

    [DataObjectMethod(DataObjectMethodType.Insert)]

    public void InsertRecord(CategoryInfo o) {

      if (o.CategoryName == null)

       { throw new AccessViolationException();}

        new SqlTaskProvider().InsertRecord(o);

    }

    [WebMethod]

    [DataObjectMethod(DataObjectMethodType.Update)]

    public void UpdateRecord(CategoryInfo o) {

      if (o.CategoryName == null) {

       throw new AccessViolationException();

    }

      new SqlTaskProvider().UpdateRecord(o);

     }

    }

    First, as required by the framework, we must put the ScriptService attribute before the Web Service so that the MS AJAX JavaScript framework will call it correctly. Second, you may have noticed that this web service doesn’t expose web methods in a typical manner. In this case, the web service is derived from DataService which exposes two special types of web methods (GetData and SaveData, you can further study them by examining the assembly Microsoft.Web.Preview.dll using the .NET object browser and Lutz Roeder's.NET Reflector tool). The methods defined here are attributed using [DataObjectMethod]. These are used by the ObjectDataSource control to expose methods that are treated as Select, Insert, Update, or Delete.

    Note here in each web method we use a helper class named SqlTaskProvider that is defined inside the ‘Demos.CategoryInfo’ namespace to make the design modular. And also, the parameter type CategoryInfo is a general C# class which acts as an OOP wrapper for a record in the CategoryInfo table.

    More ASP.NET Articles
    More By Xianzhong Zhu


     

    ASP.NET ARTICLES

    - Adding Content to a Static ASP.NET Website
    - Building a Static ASP.NET Website in a Basic...
    - 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...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek