ASP.NET按钮点击重定向到新的一页 [英] ASP.NET Button click redirect to new page
问题描述
我创建了一个按钮编程。
我现在想重定向到一个新的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按钮点击重定向到新的一页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!