基于ASP.NET AJAX的WebPart开发与部署

作者:凯旋网络来源:凯旋网络
0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    </handlers>
  </system.webServer>
利用AjaxBaseWebPart进行开发

编写使用该扩展的WebPart最简单的办法就是直接继承别人写好的AjaxBaseWebPart。下面是我用的一个。您也可以用其他的,或自己写一个。
下面是命名空间引用部分:
  using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Serialization;
using System.Web.UI;
using Microsoft.SharePoint.WebPartPages;
using Microsoft.SharePoint.Utilities;
using System.Web.UI.WebControls;
using System.Drawing;
下面是AjaxBaseWebPart类的实现部分:
      /// <summary>
    /// A base class that implements all the functionality required to use ASP.net Ajax extensions inside WSS
    /// </summary>
    [XmlRoot(Namespace = "Deps.AjaxBaseWebpart")]
    public abstract class AjaxBaseWebpart : Microsoft.SharePoint.WebPartPages.WebPart
    {
        /*
         * The idea and the code behind this base web part was taken from Erics blog post at:
         * http://www.capdes.com/2007/02/ajaxbasepart_easy_aspnet_20_aj.html
         * This basically manages the presence and configuration of the ScriptManager
         * which is required by ASP.net ajax extensions to handle postbacks, ect. This web part also includes
         * a common method for handling errors.
         */
        #region Declarations
        private string _ValidationGroupId;
        private ValidationSummary _ErrorContainer;
        private ScriptManager _AjaxManager;
        #endregion

        #region Constructor
        public AjaxBaseWebpart()
        {

        }
        #endregion

        #region Methods
        /// <summary>
        /// Used to provide a common way to display errors to the user of the current web part.
        /// </summary>
        /// <param name="message">Description of the error that occured.</param>
        public void RegisterError(string message)
        {
           

  • 广告推荐