Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8655141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:57:25+00:00 2026-06-12T14:57:25+00:00

I use a kind of javascript,when i use it in a page without master

  • 0

I use a kind of javascript,when i use it in a page without master page it works properly but when i use it in content page that use master page it doesn’t work what should i do for this problem?

i don’t use any code in masterpage for javascript is it necesssary ?

//Page1 without MasterPage
....
<head runat="server">
    <link rel="stylesheet" href="StyleSheet.css" type="text/css" media="screen"/>
    <script src="jquery-1.4.4.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="jquery.maskedinput.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () 
        {
            $.mask.definitions['~'] = "[+-]";
            $("#date").mask("99/99/9999"); //Date
            $("input").blur(function () 
            {
                $("#info").html("Unmasked value: " + $(this).mask());
            }).dblclick(function () {
                $(this).unmask();
            });
        });
    </script>
</head>
....
<body>
    <form id="form1" runat="server">
    date :  <asp:TextBox ID="date"  runat="server" ></asp:TextBox>
.....

//page2 with MasterPage
...
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
   <link rel="stylesheet" href="StyleSheet.css" type="text/css" media="screen"/>
    <script src="jquery.maskedinput.js" type="text/javascript" charset="utf-8"></script>
    <script src="jquery-1.4.4.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () 
        {
            $.mask.definitions['~'] = "[+-]";
            $("#date").mask("99/99/9999"); //Date
            $("input").blur(function () 
            {
                $("#info").html("Unmasked value: " + $(this).mask());
            }).dblclick(function () {
                $(this).unmask();
            });
        });
    </script>
</asp:Content>
....
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
     date : <asp:TextBox ID="date"  runat="server" ></asp:TextBox>
</asp:Content>


//Master Page
...
<head runat="server">
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T14:57:26+00:00Added an answer on June 12, 2026 at 2:57 pm

    In asp.net when a UserControl is placed in a container the unique IDs of its contained controls are recalculated to avoid problems with multiple controls of the same type. this is true even for pages inside master pages.

    to retrieve the correct unique ID of the controls in your page you need to write something like this

    $("#<%= date.ClientID %>").mask("99/99/9999");
    

    the <%= ... %> will be evaluated at runtime and replaced with the correct id (ClientID is a property of asp.net control which holds the unique id of the control to be rendered)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to use two javascript sliding menu on same page but in both
Is it possible to use some kind of JavaScript to change or set a
I'm trying to use Telerik RadControls in a MVVM kind of way but having
If one made a web application that never refreshed a page but was built
I have a javascript function that someone made for me. I am kind of
I've seen so many times that some websites use a kind of button or
I am having a page that loads content dynamically. Depending on which menu item
Every page on my site has multiple body classes that I use CSS selectors
I'm writing a JavaScript that generates some data. I intend to use it as
Imagine we have a server side application that generates streaming content full of JavaScript

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.