当前位置: 代码迷 >> ASP.NET >> asp.net中 CS1061异常
  详细解决方案

asp.net中 CS1061异常

热度:5375   发布时间:2013-02-25 00:00:00.0
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
  相关解决方案