Creating Customized XML Web Parts


As previously mentioned, a Web Part is simply a mechanism by which information is displayed. By default, several useful Web Parts are provided, and others can be easily downloaded from the Web and installed. Some administrators, however, may not be satisfied with what is available and may want to create their own Web Parts that display information particular to their site or projects.

Fortunately, you can leverage a built-in mechanism known as an XML Web Part to house customized code to display whatever you can program. You can program your own XML code and input that code directly into the Web Part to make it do what you want. In addition to XML, the Web Part can also use snippets of HTML code, which can be useful if you want to leverage existing code from web pages you've already created or pages from the Internet.

To create and populate an XML Web Part, follow these steps:

1.

From the page where you want to add the Web Part, click the Modify Shared Page drop-down link.

2.

From the drop-down box, select Add Web Parts and then click Browse.

3.

On the Web Part panel that opens up on the right side, choose the appropriate gallery (normally SITENAME Gallery) and choose XML Web Part (you may have to click Next to view the option).

4.

Select the zone to add it to from the Add to drop-down box and then click the Add button.

5.

After the XML Web Part has been added, click the down arrow in the upper-right area of the Web Part and choose Modify Shared Web Part.

6.

In the XML Web Part options, click XML Editor to add your custom code into the Text Entry box.

7.

Enter your XML or HTML code into the Text Entry box, similar to what is shown in Figure 18.4. You can cut and paste HTML or XML code from other pages on the Internet with functionality that you want in your Web Part. Click OK when you are finished.

Figure 18.4. Populating an XML Web Part with code.


8.

Click OK again to save the settings.



    Sams Teach Yourself Microsoft SharePoint 2003 in 10 Minutes
    Sams Teach Yourself Microsoft SharePoint 2003 in 10 Minutes
    ISBN: 672327236
    EAN: N/A
    Year: 2004
    Pages: 181

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net