16.01.2013 Views

Microsoft Sharepoint Products and Technologies Resource Kit eBook

Microsoft Sharepoint Products and Technologies Resource Kit eBook

Microsoft Sharepoint Products and Technologies Resource Kit eBook

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

1018 Part IX: Maintaining a Server in Windows SharePoint Services<br />

When exceptions occur, you now receive ASP.NET exception messages with stack<br />

trace information.<br />

Note The CallStack attribute enables this functionality for all local <strong>and</strong><br />

remote clients.<br />

Using Tracing in ASP.NET<br />

You can use the tracing feature in ASP.NET to monitor the environment of the server<br />

on which you are programming. You can use tracing on a specific page or for an<br />

entire application.<br />

To enable ASP.NET tracing on a local server<br />

You can use tracing on a local server computer without enabling it for remote clients.<br />

1. In Windows Explorer, browse to the root folder of the Windows SharePoint Services<br />

extended virtual server, for example: local_drive:\InetPub\wwwroot\bin\.<br />

2. Double-click the Web.config file.<br />

3. In the Web.config file, search for the element.<br />

4. In the element, add the following line:<br />

<br />

5. Save <strong>and</strong> close the file.<br />

The environment information now appears at the bottom of the test page that<br />

includes the Web Part.<br />

Creating Child Controls on a Web Part<br />

Now that you’ve seen how to create a simple Web Part <strong>and</strong> how to debug a Web<br />

Part you’re ready for the next level: creating child controls on a Web Part. This provides<br />

you with the possibility to create more sophisticated Web Parts. This section<br />

describes how to add TextBox <strong>and</strong> Button controls to a Web Part.<br />

The first thing you need to do is to declare two member variables at the top of<br />

the Web Part class named myTextBox <strong>and</strong> myButton, like this:<br />

private TextBox myTextBox;<br />

private Button myButton;<br />

Tip Make sure you have added the System.Web.UI.WebControls namespace.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!