当前位置: 代码迷 >> SharePoint >> sharepoint后台添加代码后,浏览网页出现异常
  详细解决方案

sharepoint后台添加代码后,浏览网页出现异常

热度:262   发布时间:2016-05-02 07:22:23.0
sharepoint后台添加代码后,浏览网页出现错误
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Publishing;
using Microsoft.SharePoint.WebControls;
namespace MossCodeBehind
{
    public class CodeBehind : PublishingLayoutPage
    {
        protected TextBox textbox1;
        protected Button button1;
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            button1.Click += new EventHandler(button1_Click);
        }


        void button1_Click(object sender, EventArgs e)
        {
            textbox1.Text = DateTime.Now.ToString();
        }
    }

}


这是类文件,已经编译成DLL文件,放在Bin文件夹下。

sharepoint页面中,也改成了下面这个

<%@ Page meta:progid="SharePoint.WebPartPages.Document" Language="C#"   
Inherits="MossCodeBehind.CodeBehind,MossCodeBehind, Version=1.0.0.0,  
Culture=neutral, PublicKeyToken=null" %> 


在我浏览页面时会出现:


没有使用母版页,为什么会出这样的错误,应该怎么解决?
SharePoint C#

------解决方案--------------------

<%@ Page meta:progid="SharePoint.WebPartPages.Document" Language="C#"   
Inherits="MossCodeBehind.CodeBehind,MossCodeBehind, Version=1.0.0.0,  
Culture=neutral, PublicKeyToken=null" %> 
  相关解决方案