2012-03-09 45 views
3

我正在使用母版頁創建一個網站,工作正常。但之後,我添加實體數據模型和一些檢索代碼到登錄頁面,它自帶了一些錯誤頁面不允許在這裏,因爲它沒有擴展類'System.Web.UI.MasterPage'

代碼如下

var tombstoneQuery = from t in crnnsupContext.Tombstones.Include("ProvState") 
          where t.RegNumber == _username 
          select t; 
List<Tombstone> tombstoneResult = tombstoneQuery.ToList(); 
Cache.Insert("Tombstone", tombstoneResult); 

的第一個錯誤發生了,當我試圖把列表到緩存,錯誤說「線程已被中止。之後我設置cache.insert語句作爲表彰,這個錯誤已經走了,但下一個來到

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: 'OnlineRenewal.Renewal' is not allowed here because it does not extend class 'System.Web.UI.MasterPage'. 

Source Error: 


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

的重建是母版頁,我沒做什麼都可以。 任何人都可以幫忙?謝謝你t

更新頁面的代碼。 (有沒有注意到)

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


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

    } 
} 
} 




<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="renewal.Master.cs" Inherits="OnlineRenewal.Renewal" %> 
+3

請顯示'Renewal'類的來源。 – SLaks 2012-03-09 20:50:19

+0

它工作正常之前,我不明白哪裏錯了。和錯誤「線程正在中止」也很奇怪 – pita 2012-03-09 21:08:39

+0

當您將該類的名稱改爲大寫時會發生什麼? '更新'與'更新' – 2012-03-09 22:10:30

回答

4

這是告訴你,OnlineRenewal.Renewal不是一個母版頁。

確保它在頁面頂部有一個<%@ Master %>指令,或者將導致此錯誤的頁面的inherits屬性更改爲其他內容。

相關問題