如何配置MasterPage以继承类文件 [英] How to configure MasterPage to Inherit class file

查看:58
本文介绍了如何配置MasterPage以继承类文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个Master页面需要从存储在App_Web_yht1mma2文件夹中的类(MasterPage2.cs)继承。



在母版页中,我将代码设置为:



Hi,

I have a Master page which needs to inherit from a class (MasterPage2.cs) stored inside "App_Web_yht1mma2" folder.

In the master page, I have set the code as:

<%@ Master Language="C#" AutoEventWireup="true" Inherits="MasterPage2,App_Web_yht1mma2" %>





当我debu g这个页面,我收到以下错误:







When I debug this page, I receive the following 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 the assembly 'App_Web_yht1mma2'. Make sure that it is compiled before accessing the page.
    
    Source Error:
    
    Line 1:  <%@ Master Language="C#" AutoEventWireup="true" Inherits="MasterPage2,App_Web_yht1mma2" %>
    Line 2:
    Line 3:
    
    Source File: /MasterPage.master    Line: 1





请告知我如何纠正此错误。



Kindly advise me on how to correct this error.

推荐答案

试试吧在代码之下,但首先需要编译App_Web_yht1mma2程序集..



try this below code but first you need to compile App_Web_yht1mma2 assembly..

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="MainMasterPageWeb.Master.cs"

    Inherits="App_Web_yht1mma2.MasterPage2" %>


这篇关于如何配置MasterPage以继承类文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆