Can anyone help me on this please. I have Jqury for MaskedEdit. This is working fine in regular web forms without master page but not working inside the content page. pls help.
i think your master page can not find reference to jquery files another solution may be
you should call your script in page load method of java script like this
function pageLoad()
{
urcode here
}
Beware of bugs in the above code; I have only proved it correct, not tried it.
-------------------------------------------------------
Contact-Info:Adils.kiet@gmail.com
Boracay
Member
142 Points
165 Posts
JQuery not working in content page ..
Jan 15, 2013 04:27 PM|LINK
Can anyone help me on this please. I have Jqury for MaskedEdit. This is working fine in regular web forms without master page but not working inside the content page. pls help.
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MaskedEditControl._Default" %> <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> </asp:Content> <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <h2> Welcome to ASP.NET! </h2> <p> <asp:TextBox ID="date" runat="server"></asp:TextBox> </p> <head> </head> <script type="text/javascript" src="Scripts/jquery-1.4.1.js"></script> <script type="text/javascript" src="Scripts/MaskedEdit.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> <link type="text/css" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/redmond/jquery-ui.css" /> <script type="text/javascript"> $(function () { $("#date") .datepicker({ nextText: "", prevText: "", changeMonth: true, changeYear: true }) .mask("99/99/9999"); // .mask("9999"); }); </script> </asp:Content>UstesG
Contributor
2098 Points
449 Posts
Re: JQuery not working in content page ..
Jan 15, 2013 04:49 PM|LINK
place your jquery script tags in the HeaderContent section. This renders it in the masterpage head section.
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> <script type="text/javascript" src="Scripts/jquery-1.4.1.js"></script> <script type="text/javascript" src="Scripts/MaskedEdit.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> <link type="text/css" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/redmond/jquery-ui.css" /> <script type="text/javascript"> $(function () { $("#date") .datepicker({ nextText: "", prevText: "", changeMonth: true, changeYear: true }) .mask("99/99/9999"); // .mask("9999"); }); </script> </asp:Content>But don't expect me to do your job!
Boracay
Member
142 Points
165 Posts
Re: JQuery not working in content page ..
Jan 15, 2013 04:55 PM|LINK
Did not work for me . :(
radamanthys
Member
228 Points
74 Posts
Re: JQuery not working in content page ..
Jan 15, 2013 05:07 PM|LINK
Your script references are MasterPage resource, for that reason, the tags must be inside the head tag.
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MaskedEditControl._Default" %> <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> </asp:Content> <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <h2> Welcome to ASP.NET! </h2> <p> <asp:TextBox ID="date" runat="server"></asp:TextBox> </p> <head>Boracay
Member
142 Points
165 Posts
Re: JQuery not working in content page ..
Jan 15, 2013 08:06 PM|LINK
No Luck : (
Boracay
Member
142 Points
165 Posts
Re: JQuery not working in content page ..
Jan 16, 2013 04:26 AM|LINK
Any Help Guys ?
Jugg3rNaut
Member
474 Points
109 Posts
Re: JQuery not working in content page ..
Jan 16, 2013 04:39 AM|LINK
tell me two things?
location of master page
and location of normal pages
i think your master page can not find reference to jquery files another solution may be
you should call your script in page load method of java script like this
function pageLoad()
{
urcode here
}
-------------------------------------------------------
Contact-Info:Adils.kiet@gmail.com
stmarti
Contributor
4963 Points
1036 Posts
Re: JQuery not working in content page ..
Jan 16, 2013 07:02 AM|LINK
Are you sure that your control id is rendered as "date" in the content page? Asp.net webform usually renders a hiararchical id for nested controls.
- Check your page source in the browsers, and look for the correct id.
- Check that the jquery script include is properly rendered.
- Put an alert in the script block to see it is ever called.
- etc.
Boracay
Member
142 Points
165 Posts
Re: JQuery not working in content page ..
Jan 17, 2013 07:40 PM|LINK
I have tried everyting and still not working.
Anyone tried this http://digitalbush.com/projects/masked-input-plugin/ JQuery in ASP.net master page.
Please share your idea.
Boracay
Member
142 Points
165 Posts
Re: JQuery not working in content page ..
Jan 20, 2013 03:45 AM|LINK
I am using AJAX and JQuery in Master Page.
Is it the probelm ? Anyone encounter this problem ?