错误呈现控件 [英] Error rendering control
问题描述
将AdRotator放在表格单元格中时出现以下错误:
错误呈现控件-Table1
发生未处理的异常.
对象引用未设置为对象的实例."
我尝试将AdRotator移出表格,并且错误消失了.当我放回去时,我再次收割.所有其他控件放在表单元格中时,不会导致此错误.它最有可能在我这边(不是Visual Studio),但是我很难确定代码中的错误.代码如下
Hi,
I''m getting the following error when i put AdRotator inside a table cell:
"Error rendering control - Table1
An unhandled exception has occured.
Object reference not set to an instance of an object."
I''ve tried moving AdRotator out of the table and the error dissapers. When i put it back i reapers again. All other controls when put in table cell dont cause this error. Its most probably something on my side (not Visual studio''s), but i''m having a really hard time pinpointing error in code. The code goes as follows
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="About.aspx.cs" Inherits="About" %>
<!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 runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Table ID="Table1" runat="server" Height="28px" Width="35px"><asp:TableRow runat="server" ID="TableRow1"><asp:TableCell runat="server" ID="TableCell1">
<asp:AdRotator ID="AdRotator1" runat="server" Visible="true"/>
</asp:TableCell></asp:TableRow></asp:Table>
</div>
</form>
</body>
</html>
有任何想法吗? (注意:.cs文件为空,也就是其中只有自动生成的代码)
我忘了提一下,当我构建解决方案时,一切都应按原样进行,即使刷新页面,AdRotator也能很好地工作.此错误仅出现在设计视图中.
Any ideas? (note: .cs file is empty aka has only auto generated code inside)
edit: I forgot to mention that when i build solution everything is as it should be and AdRotator works great even when i refresh the page. This error appears only in Design View.
推荐答案
我尝试将AdRotator移出表格,并且错误消失了.当我放回去时,我再次收割.
我不确定,但这可能是因为未为AdRotator定义XML.您是否尝试将AdvertisementFile
属性设置为某些XML?可以尝试一次.
I''ve tried moving AdRotator out of the table and the error dissapers. When i put it back i reapers again.
I am not sure of it but it might be because of XML not defined for the AdRotator. Did you try to set theAdvertisementFile
property to some XML? Can try once.
这篇关于错误呈现控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!