2011-04-15 79 views
0

这工作:可以不加控制,用户控件

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Comments.ascx.cs" Inherits="Controls_Comments" %> 

Add comment 

但这:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Comments.ascx.cs" Inherits="Controls_Comments" %> 

Add comment 
<asp:Button runat="server" ID="lol" /> 

抛出这个错误我以前从未见过:

Compilation Error 

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

Compiler Error Message: CS1502: The best overloaded method match for 'System.Web.UI.Control.ApplyStyleSheetSkin(System.Web.UI.Page)' has some invalid arguments 

Source Error: 


Line 190:   #line hidden 
Line 191:   this.lol = @__ctrl; 
Line 192:   @__ctrl.ApplyStyleSheetSkin(this.Page); 
Line 193:    
Line 194:   #line 5 "C:\inetpub\wwwroot\ScirraNew\Controls\Comments.ascx" 

Source File: c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\scirranew\3a1c901c\f2f0205e\App_Web_comments.ascx.cc671b29.aem6dvrt.0.cs Line: 192 

任何帮助表示赞赏,我不能在谷歌上看到很多关于它:(我已经将它添加到web.config这种方式:

<add tagPrefix="Scirra" src="~/Controls/Comments.ascx" tagName="Comments"/> 

代码隐藏页:

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

public partial class Controls_Comments : System.Web.UI.UserControl 
{ 
    /// <summary> 
    /// Anchor (GUID/UniqueIdentifier) for the comments 
    /// </summary> 
    public System.Guid Anchor { get; set; } 

    /// <summary> 
    /// Comment page to load 
    /// </summary> 
    public int Page { get; set; } 

    public int TotalComments { get; set; } 
    public int TotalPage { get; set; } 

    protected void Page_Load(object sender, EventArgs e) 
    { 

    } 
} 
+0

什么是实际的异常消息?例如,编译器错误是什么意思,或者死亡的黄色屏幕说什么? – Tejs 2011-04-15 20:26:41

+0

@Tejs我已经更新了黄色屏幕上的所有内容的错误 – 2011-04-15 20:28:11

+0

听起来像你的代码背后的东西。 – Tejs 2011-04-15 20:29:26

回答

5

如果我理解正确的话,你的声明命名页面的公共属性,这是一个整数:

public int Page { get; set; } 

然后你使用这个属性应用样式表皮肤:

@__ctrl.ApplyStyleSheetSkin(this.Page); 

尝试将您的属性重命名为某物其他(PageCount,NumberOfItemsOnPage,PageID等)。 或分配正确的类型此属性:

public System.Web.UI.Page Page { get; set; } 
0

也有这个奇怪的问题,它让我拉我的头发。然后,我打我....

1)我已经开始了新的VS 2010的C#Web项目

2)我删除了一堆自动生成的项目文件(包括的Site.Master的)

3)我开始建立我的基本代码框架

4)我创建了一个新的Site.Master文件

5)当我添加的第一个服务器控件(标签)的网站。主人,我开始得到错误

6.)然后它打我,也许有东西卡在临时文件,设计器文件或缓存中,它仍然在尝试编译(称之为)幽灵(缺乏更好的术语)原始网站。主文件没有添加新的Label控件。

我将我的新Site.Master文件重命名为SiteMaster.Master,并且该站点再次正常运行。 (很显然,我必须更新我的所有子页面以使用新的正确母版页)。

不确定原始Site.Master ghost文件被隐藏的位置。即使尝试从C:\,重建项目,清理项目,重新启动VS,重新启动PC等等杀死所有临时ASP.NET文件。超级怪异。

但我只是想我会分享这个愚蠢的错误,我跑了20分钟,然后才想出来!

最好!