03.11.2016 Views

Beginning ASP.NET 4.5 in CSharp and VB Opsylum

Create successful ePaper yourself

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

Us<strong>in</strong>g Server Controls with LINQ Queries x 529<br />

7. Click OK to close the dialog box. If you get a dialog box that asks if you want to regenerate the<br />

ListView control, click Yes.<br />

8. Switch to Markup View <strong>and</strong> remove the code for the follow<strong>in</strong>g templates. To make this as easy as<br />

possible, click the relevant open<strong>in</strong>g tag once, then click the tag <strong>in</strong> the Tag Selector at the bottom of<br />

the Document W<strong>in</strong>dow to select the entire element <strong>and</strong> its content, <strong>and</strong> then press the Delete key.<br />

Alternatively, you can collapse the tag us<strong>in</strong>g the plus (+) symbol <strong>in</strong> the left marg<strong>in</strong>, select the whole<br />

l<strong>in</strong>e, <strong>and</strong> delete it at once.<br />

‰ <br />

‰ <br />

‰ <br />

‰ <br />

‰ <br />

The only three rema<strong>in</strong><strong>in</strong>g template elements should now be InsertItemTemplate, ItemTemplate,<br />

<strong>and</strong> LayoutTemplate.<br />

9. Locate the element <strong>in</strong> the LayoutTemplate <strong>and</strong> remove its ID, runat, <strong>and</strong> style attributes.<br />

Then add a class attribute <strong>and</strong> set it to ItemConta<strong>in</strong>er. You can also remove the empty <br />

element that VS added for you below the . Your now conta<strong>in</strong>s this code:<br />

<br />

<br />

<br />

<br />

<br />

10. Locate the ItemTemplate <strong>and</strong> remove the l<strong>in</strong>es that make up the Id, PhotoAlbumId, <strong>and</strong><br />

PhotoAlbum columns, bolded <strong>in</strong> the follow<strong>in</strong>g code snippet, because you don’t need them. Make<br />

sure you don’t accidentally delete the open<strong>in</strong>g tag:<br />

<br />

Id:<br />

<br />

<br />

Description:<br />

<br />

<br />

ToolTip:<br />

<br />

ImageUrl:<br />

<br />

PhotoAlbumId:<br />

<br />

<br />

PhotoAlbum:<br />

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

Saved successfully!

Ooh no, something went wrong!