Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a master page and have 3 content page say cp1, cp2 and home.

I have a common button in master page to go home page say bntHome.

if i opened cp1 or cp2 and click btnHome then it open the home page.

what is the code for that?
Posted
Comments
Vigneshb6 3-Jan-11 6:18am    
Write in the button Click to Redirect to Home Page using Response.Redirect or Server.Transfer
TejuKrishna 3-Jan-11 6:23am    
Set Buttons PostBackUrl Property to HomePage.

Write the below code in bntHome Click event.
Response.Redirect("Home.aspx");

Your button is in master page. So you don't worry about content pages.
 
Share this answer
 
Did you try this in the button click event handler?
C#
Response.Redirect("~/MyHomePage.aspx");
 
Share this answer
 
v2
try it out onbuttonclick
Response.Redirect("Home.aspx");
 
Share this answer
 
I think if you're putting button at home page then there will be same inheritance to all content pages.

By providing NavigationURL property or on click event Redirection will create same functionality for all the pages.

Give the URL of your home page only and it will work same for all the content pages.
 
Share this answer
 
Comments
Md. Mahfujul 3-Jan-11 6:55am    
Thanks
Hiren solanki 3-Jan-11 6:56am    
you're welcome.

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