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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

Return To Home&nbsp;&nbsp;&nbsp;&nbsp;<br />

Refresh Page<br />

<br />

<br />

Save your work by pressing Ctrl+S or selecting File <strong>and</strong> then clicking Save<br />

ProbSolutionKB.aspx. Then test the page by right-clicking the name in the Solution<br />

Explorer window pane, selecting Browse With, <strong>and</strong> then selecting Internet Explorer.<br />

Again, do not use the Visual Studio internal browser to test this page, as it will mask<br />

problems that the other browsers do not.<br />

Add a DataList to the Page In this next part of this example, we have to add a<br />

component (a DataList object) to the page <strong>and</strong> write some procedural code that will<br />

load data from the Windows SharePoint Services Web Part into our ASP.NET Page.<br />

Adding a DataList to the ASP.NET page is done in the HTML editor in either<br />

Design mode by means of a drag-<strong>and</strong>-drop operation, or it’s done by simply coding<br />

the object in by h<strong>and</strong>. (Most folks prefer to use both. They use a drag-<strong>and</strong>-drop<br />

operation to place the object on the page <strong>and</strong> then switch to the HTML editor<br />

to change the attributes.) For this example, we did both, as you will likely do on<br />

real projects.<br />

If it is not open already, open the ProbSolutionKB.aspx page in the HTML editor<br />

<strong>and</strong> make sure it is in HTML mode. Then in the table we created in HTML, add<br />

a new Table Row <strong>and</strong> put a marker there as shown in the following code:<br />

<br />

Return to Home<br />

&nbsp;&nbsp;&nbsp;&nbsp;<br />

Refresh Page<br />

<br />

<br />

PUTCONTROLHERE<br />

<br />

Switch to Design mode <strong>and</strong> you’ll see the marker “PUTCONTROLHERE” on the<br />

page. Click the Toolbox, <strong>and</strong> under the Web Forms click DataList <strong>and</strong> drag it until<br />

you see the cursor ( | ) appear in or next to the marker text. (If you do not see the<br />

toolbox, from the top menu, select View <strong>and</strong> then click Toolbox or press<br />

Ctrl+Alt+X.)<br />

On the page, delete the text marker (PUTCONTROLHERE) so that only the<br />

control remains in the table row. Right-click the DataList, <strong>and</strong> then from the menu<br />

select Properties. This should open the Properties window for the DataList, which<br />

allows you to work with the majority of settings for determining how the DataList<br />

will appear.<br />

For the example, right-click on the list <strong>and</strong> select Properties. From the Properties<br />

page, select AutoFormat <strong>and</strong> choose a style. (Doing this is not required, but for<br />

this example, the Colorful 1 style was selected.)

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

Saved successfully!

Ooh no, something went wrong!