I am very new to asp.net (2 days old) and am being rushed into creating two webpages. I do have extensive knowledge in desktop programming but not with asp. I am having trouble figuring out how to launch or rather redirect to another page on a button click
this is basically what I am gunning for. I have searched on how to do this via script but have not succeeded. Even if I do succeed I would want that script to only run and redirect only if the bool above is true.
I am getting an error when I use Response.Redirect();
Server Error in '/' Application
HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Marv102
Member
4 Points
14 Posts
Help. Redirecting to new page on C# code behind button click
Dec 18, 2012 04:09 PM|LINK
I am very new to asp.net (2 days old) and am being rushed into creating two webpages. I do have extensive knowledge in desktop programming but not with asp. I am having trouble figuring out how to launch or rather redirect to another page on a button click
//psuedo code
Button1.OnClick()
{
//registeres user with db
bool Check = RegisterUser(param, param, param, etc.);
if (Check == true)
UserCenter.aspx.open()?;
else
lblError.Text = "Something happened.";
}
this is basically what I am gunning for. I have searched on how to do this via script but have not succeeded. Even if I do succeed I would want that script to only run and redirect only if the bool above is true.
Vipindas
Contributor
5514 Points
810 Posts
Re: Help. Redirecting to new page on C# code behind button click
Dec 18, 2012 04:19 PM|LINK
Button1.OnClick() { //registeres user with db bool Check = RegisterUser(param, param, param, etc.); if (Check == true) Response.Redirect("UserCenter.aspx"); else lblError.Text = "Something happened."; }Hope this helps...
abiruban
All-Star
16038 Points
2734 Posts
Re: Help. Redirecting to new page on C# code behind button click
Dec 18, 2012 04:20 PM|LINK
Hi try this
Response.Redirect("UserCenter.aspx");
***DON'T FORGET TO CLICK “MARK AS ANSWER” ON THE POST IF HELPED YOU.
Marv102
Member
4 Points
14 Posts
Re: Help. Redirecting to new page on C# code behind button click
Dec 18, 2012 05:05 PM|LINK
I am getting an error when I use Response.Redirect();
Server Error in '/' Application
HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Marv102
Member
4 Points
14 Posts
Re: Help. Redirecting to new page on C# code behind button click
Dec 18, 2012 05:29 PM|LINK
Got it. added ~/ to the path name