Hey guys,
I'm trying to run a javscript on a page which also has a master page but it won't run.
Please tell me the procedure for it.

That doesn't really give us enough information to indicate what the problem may be other than "it doesn't work." Please give us a little more background on the issue.

What I did to solve this for my master pages was putting a placeholder in the <head> tag of the master page:

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="PROJ.master.cs" Inherits="PROJ.Web.PROJ" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder EnableViewState="False" ID="localCssPlaceholder" runat="server"></asp:ContentPlaceHolder>

A nested master page from the above master page:

<%@ Master Language="C#" MasterPageFile="~/PROJ.Master" AutoEventWireup="true" CodeBehind="NestedRightSideEmpty.master.cs" Inherits="PROJ.Web.NestedRightSideEmpty" %>
<asp:Content ID="Content2" ContentPlaceHolderID="localCssPlaceholder" runat="server">
  <asp:ContentPlaceHolder ID="cphHead" runat="server"></asp:ContentPlaceHolder>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="cphA3A" runat="server">
		<div id="divLeftRght">
        <div id="divRghtSide"><asp:ContentPlaceHolder ID="cphRght" runat="server"></asp:ContentPlaceHolder></div>
        <div id="divLeftSide"><asp:ContentPlaceHolder ID="cphLeft" runat="server"></asp:ContentPlaceHolder></div>
        <br clear="all" />  
    </div>
</asp:Content>

Then finally a page derived from the 2nd master page implementing javascript in the header:

<%@ Page Title="" Language="C#" MasterPageFile="NestedRecordBuilder.master" AutoEventWireup="true" CodeBehind="Allergies.aspx.cs" Inherits="PROJ.Web.members.profile.Allergies" ValidateRequest="false" %>
<%@ Register src="../../ctrls/ucAllergyGroup.ascx" tagname="ucAllergyGroup" tagprefix="uc1" %>
<asp:Content ID="Content2" ContentPlaceHolderID="cphHead" runat="server">
	<script type="text/javascript">
		function showElements(d) {
			var showtheDIV = document.getElementById(d);
			if (showtheDIV.style.display == "none") {
				showtheDIV.style.display = "block";
			}
			else { showtheDIV.style.display = "none"; }
		};	
	</script>
</asp:Content>

Hey Guys,
I have a button on my content and also has handler which is described in the C# file (code-behind). On the button click a calender pops up and the user is supposed to select a date. On selecting a date the date gets typed in a text box in the opener window. This was happening until i added a master page. Please Help..It's urgent...

Are you referring the textbox in the calendar popup?

If you add master page and content place hodler controls, the name of the textbox will be rendered like ctl00_ContentPlaceHolder1_txtYourTextBoxName..

Therefore see the correct name in the view source and put it in your calendar popup code.

I am referring to the textbox in my main page which open ups the calender.
I've checked all the id's, all are correct.

Why don't you post some code?

Is there any error message displayed?

string strend = "ctl00_ContentPlaceHolder1_Text_edate";
                 String sb = "<script>window.opener.document.forms[0]." + strend + ".value = '"
                 + Convert.ToString(edate)
                 + "';"
                 + "self.close();"
                 + "</script>";
string strCalScript = sb.ToString();
                 this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "transferedate", sb.ToString());

Everything is working in this script but the window doesn't close.
Please tell why??
But the window does close if i add a alert before it.

@anuj576 I just joined all 3 post to related same JavaScript question. In the future DO NOT create new post just because you want to provide new info, stick to original thread and just post there with new updates

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.