Reputation: 67
I have a very simple (currently) 1 page aspx website. It fails to compile with a message that I have not seen before. All other examples all seem to refer to master pages, which I do not have.
"Parser Error Message: 'Options.WebForm1' is not allowed here because it does not extend class 'System.Web.UI.Page'.
Source Error:
Line 1: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Options.WebForm1" %>
Line 2:
Line 3:
Here is the top of Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
Inherits="Options.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
And for Default.aspx.cs
namespace Options
{
public partial class _Default : Page
{
Upvotes: 0
Views: 2618
Reputation: 144
What is Options.WebForm1 in <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Options.WebForm1" %>
It should look like this if you are using a namespace
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Options._Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView runat="server" ID="grdTest"></asp:GridView>
</div>
<asp:TextBox runat="server" Id ="callfmptxt"/>
</form>
</body>
</html>
Code Behind-
using System;
using System.Web.UI;
namespace Options
{
public partial class _Default : Page
{
private double callfmp = 0;
public double BlackScholes(string CallPutFlag, double S, double X, double T, double r, double v) { return 0.0;}
protected void allfmptxt_TextChanged(object sender, EventArgs e) { }
}
}
Upvotes: 2