开发者

Master page gives error

开发者 https://www.devze.com 2023-03-01 06:34 出处:网络
I am using VS2008 for ASP.NET apps. My Solution Explorer has hierarchy like this: The start-up page, Default.aspx, displays a Login form. When I press Login button, an开发者_JS百科other Page with

I am using VS2008 for ASP.NET apps.

My Solution Explorer has hierarchy like this:

Master page gives error

The start-up page, Default.aspx, displays a Login form. When I press Login button, an开发者_JS百科other Page with the name, selectCompany, should open. selectCompany is a Web Content Form whose master page is Master1.Master. But it is not opening, instead I am getting this error:

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

    Parser Error Message: Could not load type 'FlexStock.Forms.master1'.

    Source Error:

    Line 1:  <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="~/Forms/selectCompany.aspx" Inherits="FlexStock.Forms.master1" %>
    Line 2:  
    Line 3:  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


    Source File: /Forms/master1.Master    Line: 1 

The first line of Master1.master is like this:

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="master1.master.cs" Inherits="FlexStock.Forms.master1" %>

And the first line of Web Content Form, selectCompany.aspx, is like this:

<%@ Page Title="" Language="C#" MasterPageFile="~/Forms/master1.Master" AutoEventWireup="true" CodeBehind="selectCompany.aspx.cs" Inherits="FlexStock.Forms.selectCompany" %>

I am not following where is the problem.


Make sure that the class-name stated in the Inhertis-part of your page-directive matches the name of the class in your code-behind file.

Master1.master:

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="master1.master.cs" Inherits="FlexStock.Forms.master1" %>

Master1.Master.cs:

namespace FlexStock.Forms {
    public class master1 {
        /* ... */


Have you built your project w/o any errors/warning?

Error says that its unable to find code-behind class FlexStock.Forms.master1 so issue will be likely in master1.Master.cs or designer.cs - where you may have changed the namespace or class name w/o making the same change in markup. Or there is some compilation error and VS is unable to generate the assembly (or unable to put it in bin folder)


If you can see the bin folder in Explorer, but not in VS, try "Including" it in your project.

Maybe drag the folder into Solution Explorer, and then right-click it and Include it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号