03.11.2016 Views

Beginning ASP.NET 4.5 in CSharp and VB Opsylum

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

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

488 x CHAPTER 13 DISPLAYING AND UPDATING DATA<br />

FIGURE 13-22<br />

13. Click OK to close the dialog box. The code for the InsertItemTemplate now looks like this <strong>in</strong><br />

Markup View:<br />

<br />

<br />

<br />

<br />

14. Copy the contents of the InsertItemTemplate (the bolded code <strong>in</strong> the previous step) <strong>and</strong> paste<br />

it <strong>in</strong> the EditItemTemplate, overwrit<strong>in</strong>g the exist<strong>in</strong>g TextBox control. This adds the same dropdown<br />

list to the DetailsView <strong>in</strong> edit mode.<br />

15. Switch back to Design View, click the DetailsView, <strong>and</strong> press F4 to open up the Properties Grid.<br />

Switch to the Events tab of the Properties Grid <strong>and</strong> double-click the follow<strong>in</strong>g events. VS switches<br />

to the Code Beh<strong>in</strong>d file every time you double-click an event, so you need to switch back to the<br />

page (us<strong>in</strong>g Ctrl+Tab) to add the other events:<br />

‰ ItemInserted<br />

‰ ItemInsert<strong>in</strong>g<br />

‰ ItemUpdated<br />

‰ ItemUpdat<strong>in</strong>g<br />

When you’re done, the event category of the Properties Grid should look like Figure 13-23.

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

Saved successfully!

Ooh no, something went wrong!