首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

asp.net中 CS1061异常

2012-04-22 
asp.net中 CS1061错误源码:asp:Button IDButton3 runatserver TextButton OnClickwindow.fram

asp.net中 CS1061错误
源码:
<asp:Button ID="Button3" runat="server" Text="Button" OnClick='window.frames["iframeWeather"].location.href="./NewsContent.aspx"' />

错误:
编译器错误消息: CS1061: “ASP.z_ctrltest_aspx”不包含“window”的定义,并且找不到可接受类型为“ASP.z_ctrltest_aspx”的第一个参数的扩展方法“window”(是否缺少 using 指令或程序集引用?)

疑惑:
下面源码可以正常运行,为什么在asp:button中就报错呢?
<input type="button" id="Button2" runat="server" value="Button" onclick='window.frames["iframeWeather"].location.href="./NewsContent.aspx"' />
 

[解决办法]
OnClick改成OnClientClick

热点排行