Click here to Skip to main content
15,878,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi there, please help me with a sample code i can use to navigate/link to different pages of my website, other than using the property window. i am developing an website and i would like to use a custom code behind buttons so that i can be able to navigate through my different pages. I know about the property for controls and i don't want to use that, nut rather i would love to have a custom code. Please help me.

Yours faithfully,

Use this under the onclick event of your buttons:

Response.Redirect("bla bla");
Share this answer
Share this answer
If on your .aspx page you have a set of links:
<a id="link1" runat="server/><br mode=" hold=" /><a id=" link2=" runat=" server="" />

Then you can in your code behind in the OnPreRender:
link1.Href = "";
link1.InnerText = "The Code Project";

link2.Href = "";
link2.InnerText = "MSDN";

You can do the same thing with a <asp:hyperlink ...> tag except you set the NavigateUrl and Text properties.
Share this answer
there r two ways to redirect to another page from ur page, both the ways has there prows and cons which u can kno frm internet or books
1: response.redirecr("urpage.aspx")
Share this answer
you can use server side as well as client side code to achieve this. use response.redirect for server side, onclick event and window.location of javascript onclick event, to redirect page.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900