Csharp/C#教程:单击C#(webpart)中的“取消”按钮时重定向到新页面分享


单击C#(webpart)中的“取消”按钮时重定向到新页面

// Cancel button tc = new TableCell(); btnCancel = new Button(); btnCancel.Text = "Cancel"; btnCancel.Click += new EventHandler (btnCanel_Click ) ; tc.Controls.Add(btnCancel); tr.Controls.Add(tc); t.Controls.Add(tr); // Empty table cell tr = new TableRow(); tc = new TableCell(); tr.Controls.Add(tc); this.Controls.Add(t); } protected void btnCanel_Click(object sender, EventArgs e) { } 

我要做的是。 当我点击取消按钮时,它会将我重定向到“Example.aspx”。 我使用C#创建一个webpart

要在服务器上执行您想要的操作,就是Response.Redirect 。 虽然没有必要回发。 有一些客户端解决方案。 使用LinkBut​​ton,w / onclick html属性设置为false。 我的推荐是这样的:

  

 protected void btnCanel_Click(object sender, EventArgs e) { Response.Redirect("example.aspx"); } 

调用HttpResponse.Redirect方法。

例:

上述就是C#学习教程:单击C#(webpart)中的“取消”按钮时重定向到新页面分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!

 Response.Redirect("Example.aspx"); 

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/cdevelopment/1250566.html

(0)
上一篇 2022年11月4日
下一篇 2022年11月4日

精彩推荐