asp确保定义了类 [英] asp make sure that the class defined

查看:79
本文介绍了asp确保定义了类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的probmel在运行时被取消...

这是在下面给出的..



asp确保类定义为int这个代码文件匹配inheritsattribut并且它出现了正确的基类(例如页面或用户控件)



代码背后的代码

 使用系统; 
使用 System.Collections.Generic;
使用 System.Linq;
使用 System.Web;
使用 System.Web.UI;
使用 System.Web.UI.WebControls;

命名空间 fc
{
public partial class Sitemaster:System.Web.UI.MasterPage
{
protected void Page_Load( object sender,EventArgs e)
{

}
}
}





我的源代码

 <%@       语言  =  C#    AutoEventWireup   =  true    CodeFile   =  Sitemaster.master.cs   继承  =   MasterPage   %>  

< !DOCTYPE html PUBLIC - // W3C // DTD XHTML 1.0 Transitional // EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd >

< html xmlns = http://www.w3.org/1999/xhtml >
< head id = Head1 runat = server >
< title > 同学< / title >
< script language = JavaScript type = text / javascript >
function sessionclear(){
javascript: window history .go();
}
< / 脚本 >

< asp:ContentPlaceHolder id = head runat = 服务器 >
< / head >
< body background = images / usr img / ClassmatesBGImage1(2).jpg bgcolor = #e9eef1 >
< 表格 id = form1 runat = server >
< class = style1 >

< tr >
< td class = style6 >
& nbsp; < / td >
< td class = style9 style = vertical-ali gn:top >
< asp:ContentPlaceHolder ID = ContentPlaceHolder1 runat = 服务器 >

< / td > ;
< td class = style12 style = vertical-align:top >
& nbsp; < < span class =code-leadattribute> / td >
< td class = style15 style = vertical-align:top >
< asp:ContentPlaceHolder ID = ContentPlaceHolder2 runat = server >

< / td >
< td < span class =code-keyword>>
& nbsp; < / td >
< ; / tr >
< / table >
< / form >
< / body >
< / html >

添加的代码块[/ Edit]

解决方案

< blockquote> Inherits =MasterPage应为Inherits =fc.Sitemaster


my probmel is ouccured on runtime...
which is given below..

asp makes sure that the class defined int this code file matches the "inherits" attribut and that it exteds the correct base class(e.g page or usercontrol)

my code behind code

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

namespace fc
{
    public partial class Sitemaster : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}



my source code

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Sitemaster.master.cs" Inherits="MasterPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Classmates</title>
   <script language="JavaScript" type="text/javascript">
              function sessionclear() {
              javascript: window.history.go();
              }
</script>

    <asp:ContentPlaceHolder id="head" runat="server">
</head>
<body background="images/usr img/ClassmatesBGImage1 (2).jpg" bgcolor="#e9eef1">
    <form id="form1" runat="server">
    <table class="style1">
        
        <tr>
            <td class="style6">
                &nbsp;</td>
            <td class="style9" style="vertical-align: top">
                <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
                
            </td>
            <td class="style12" style="vertical-align: top">
                &nbsp;</td>
            <td class="style15" style="vertical-align: top">
                <asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
                
            </td>
            <td>
                &nbsp;</td>
        </tr>
    </table>
    </form>
</body>
</html>

[Edit]Code blocks added[/Edit]

解决方案

Inherits="MasterPage" should be Inherits="fc.Sitemaster"


这篇关于asp确保定义了类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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