Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hope someone will help.....



I have a div tag in master page, it should be visible after redirecting to child page. There are many child pages with one master page so i dont want to write code in all child pages. Here for redirectinon i am using anchor tags and i want to write code or javascript in master page only NOT in child page.
Posted
Updated 20-Oct-13 19:25pm
v2
Comments
Thanks7872 21-Oct-13 2:00am    
Master page contains the content which is common in child pages. So if you want to hide some thing based on the page,then you should have it on child page,not on Master page.
sravantarun 21-Oct-13 2:19am    
Thanks for the reply.
sravantarun 21-Oct-13 3:05am    
i got it may be it will help to someone.

In my masterpage i am giving querystring value at anchor tag. while redirecting to child page the page should asso redirect to master page. so in masterpage page load function i am searching for querystring and then making div tag visible(div should be at runat="server")

1 solution

Hello
I have tried it behind the master page and it's working fine see the below code as per your requirements
C#
using System.IO;
public partial class SiteMaster : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string url = Path.GetFileName(Request.Url.AbsolutePath);
        if (url == "Childpage.aspx")
        {
            divId.Visible = true;
        }
    }
}
 
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