View Single Post
  #13 (permalink)  
Old May 7th, 2019, 05:35 PM
dkeller dkeller is offline
Registered User
Points: 24, Level: 1
Points: 24, Level: 1 Points: 24, Level: 1 Points: 24, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2018
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The instructions in the exercise on page 213 specifically say, "You must leave the CodeFile attribute alone; VS will change it to the right Code Behind file automatically whenever you add a new page to the site." That's why I didn't change it. My temporary file matched what was shown on page 213.

However, I am still getting the same errors. Here is the new page I created with the template:

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/Frontend.Master" AutoEventWireup="true" CodeFile="May7TestPage.aspx.cs" Inherits="$relurlnamespace$_May7TestPage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" runat="server">
</asp:Content>

You can see that $relurlnamespace$ has not been substituted in the Inherits attribute.

Here is the template file (I called it FinalTemp):

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/Frontend.Master" AutoEventWireup="true" CodeFile="$safeitemname$.aspx.cs" Inherits="$relurlnamespace$_$safeitemname$" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" runat="server">
</asp:Content>

And here is FinalTemp.aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace dkwebapp1
{
public partial class $relurlnamespace$_$safeitemname$ : BasePage
{
protected void Page_Load(object sender, EventArgs e)
{

}
}
}

I am using Visual Studio Professional version 15.9.11. Is there a setting that used to be a default that maybe isn't any more? I copied your code directly into my file and it still isn't working...
Reply With Quote