Walkthrough: Creating a Basic Web Part that supports ASP.net ajax

Source: Internet
Author: User
Tags reference visual studio

This walkthrough describes the steps for creating a basic Web Part that supports ASP.net AJAX that you can add to a Web Part Page. This example creates a SayHello Web Part that is used in a Windows SharePoint Services 3.0 Web site that derives from the ASP.net 2.0 WebPart class (system.web.u in the ASP.net class library) I.webcontrols.webparts namespace).

Prerequisite

Windows SharePoint Services 3.0

Visual Studio 2005

Step 1: Create a WEB part project

To create a WEB parts control that supports AJAX, you can first create a class library object in the class library in Visual Studio 2005.

To create an ASP.net Web part project in Visual Studio 2005

Start Visual Studio 2005.

On the File menu, point to New, and then click Project.

Under Visual Basic or C # in project type, select Windows.

In the Templates pane, select Class Library.

Type Sample.sayhello as the project name.

Step 2: Rename the base class and add the required namespaces

After the project is created, a blank class file is displayed. You can change the default class name "Class1" to easily identify new WEB parts. A class library project contains only a small number of namespaces. You need to add two required namespaces and references to their assemblies. You must also derive the base class from System.Web.UI.WebControls.WebParts.WebPart. Then, you must add two global variables to update the user interface (UI).

Adding namespace references and shared user interface components

Rename the default class in the following ways: In Solution Explorer, select Class1.cs, right-click, click Rename, and then type Sayhellowebpart as the file name.

On the Project menu, click Add Reference.

In the Add Reference dialog box, on the. NET tab, select System.Web.Extensions and click OK.

Repeat steps 2 and 3 for the System.Web namespace.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.