If you have been following us so far, your code should be bug free, as the sample code has been thoroughly tested. In order to demonstrate debugging, we will now introduce a bug into the template code.
To add a bug to the Plant template file:
Open the TropicalGreen solution in Visual Studio .NET.
Open the
Plant.aspx
template file.In HTML view, replace the text markers
(Space
for
Plant
Common
Name)
with the following code:<h1> <asp:Literal id="PlantCommonName" runat="server"></asp:Literal> </h1>
To preview the layout of the page, toggle to
Design
view.
Double-click on the template file in
Design
view. This will bring you to thePage_Load()
event of the code-behind file. First, add the required namespace at the top of the code:using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; ...