aspx页面代码
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test1.aspx.cs" Inherits="test1" %><!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:Button ID="Button1" runat="server" Text="Button"/>
</div>
</form>
</body>
</html>aspx.cs代码
protected void Page_Load(object sender, EventArgs e)
{
Button btn = Page.FindControl("Button1") as Button;
btn.Attributes.Add("onclick", "window.location.href='au-result.aspx'");
}
为什么不能跳转?
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test1.aspx.cs" Inherits="test1" %><!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:Button ID="Button1" runat="server" Text="Button"/>
</div>
</form>
</body>
</html>aspx.cs代码
protected void Page_Load(object sender, EventArgs e)
{
Button btn = Page.FindControl("Button1") as Button;
btn.Attributes.Add("onclick", "window.location.href='au-result.aspx'");
}
为什么不能跳转?
解决方案 »
- ASP.NET用什么控件可以实现这样的效果
- 请问这个问题如何解决?
- gridview删除行后无反应,必须重新打开页面才能看见删除后结果,小弟很急,在线等,谢谢帮忙!
- 救命的问题!
- asp.net自定义控件注册问题.请大侠帮忙!
- SliderExtender的文本框为什么总是显示出来
- 我在用户控件里有如下代码?请问如何调用?
- 在.NET中有人使用过Interop.BrowserType这个COM控件吗
- Server.Transfer()怎么在页面直接传值
- 用过vs.net2003的兄弟,请告知相对于vs.net2002有哪些改进!老板让我买一套。
- 简单问题:选择gridview特定列传值
- 请问嵌套在iframe里的页面可以控制iframe的src吗?
或者写在onclientclick属性试试