ASP.NET按钮点击重定向到新的一页

编程入门 行业动态 更新时间:2024-10-11 23:16:26
本文介绍了ASP.NET按钮点击重定向到新的一页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我创建了一个按钮编程。我现在想重定向到一个新的aspx页面上的这个按钮的点击,这样我们将进入新页面的方法之一(如的Page_Load(),等。)

I have created a Button programmatically. I now want to redirect to a new aspx page on the click of this Button, such that we will enter into one of the methods of the new page (like page_load(), etc.)

这可能吗?

例如:

Button oButton = new Button; oButton.Text = "NextPage"; // Redirect to "Redirect.aspx" on click

但我不能够找到Redirect.aspx切入点,在那里我可以做一些更改UI组件一旦我们重定向到Redirect.aspx

But I am not able to find an entry point in Redirect.aspx where I can do some changes to the UI components once we get redirected to "Redirect.aspx"

问候,

Parag

推荐答案

您可以使用查询字符串参数,并根据参数呼叫的Page_Load 适当的方法的价值 Redirect.aspx 例如。

You can use query string parameters and depending on the value of param call the appropriate method in Page_Load of Redirect.aspx e.g.

Redirect.aspx?val=1

在Redirect.aspx

in Redirect.aspx

protected void Page_Load(...){ string var = Request.QueryString["val"]; if(var == "1") some_method(); else some_other_method(); }

更多推荐

ASP.NET按钮点击重定向到新的一页

本文发布于:2023-11-06 03:24:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1562603.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:到新   重定向   按钮   ASP   NET

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!