lapucca
asked on
My Javascript/jQuery code no longer working after I break up the page into Materpage and content page
Hi, I'm using asp.net 3.5 and C#
Attached is the Master and content page files and the original page when they're all together. Can someone see what's wrong that cause the code not to work anymore? thanks.
AddNewPatient.aspx
AddNewPatient.aspx.cs
ManageAccounts.aspx
ManageAccounts.aspx.cs
MasterPage.master
MasterPage.master.cs
Attached is the Master and content page files and the original page when they're all together. Can someone see what's wrong that cause the code not to work anymore? thanks.
AddNewPatient.aspx
AddNewPatient.aspx.cs
ManageAccounts.aspx
ManageAccounts.aspx.cs
MasterPage.master
MasterPage.master.cs
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for the performance tip on the ToolkitScriptManager.
I removed the actualy script code from the Master pager and modified the script ref as follow. In the content page I only added the toolscriptmanger. the jQuery code was already at the content page in the ContentPlaceHolderID="head " section. I'm attaching these 2 files so you can see them.
I ran the program and got error in the Firebug using the "~'. It says '$' is not defined. I think it's not able to find jQuery ref. I changed to use "..' but then no error and nothing happens. Please have another at why my code isn't working. thank you.
I removed the actualy script code from the Master pager and modified the script ref as follow. In the content page I only added the toolscriptmanger. the jQuery code was already at the content page in the ContentPlaceHolderID="head
I ran the program and got error in the Firebug using the "~'. It says '$' is not defined. I think it's not able to find jQuery ref. I changed to use "..' but then no error and nothing happens. Please have another at why my code isn't working. thank you.
//With this I got $ is not defined error
<head runat="server">
<title>Adapt Survey Administration</title>
<link href="~/CSS/AdaptStyle.css" rel="stylesheet" type="text/css" />
<link href="~/CSS/superfish.css" rel="stylesheet" type="text/css" />
<link href="~/CSS/superfish.css" rel="stylesheet" type="text/css" />
<script src="~/jQuery/jquery-1.5.1.min.js" type="text/javascript"></script>
<script src="~/jQuery/superfish-1.4.8/js/hoverIntent.js" type="text/javascript"></script>
<script src="~/jQuery/superfish-1.4.8/js/superfish.js" type="text/javascript"></script>
//With this I get no error but also nothing happens
<head runat="server">
<title>Adapt Survey Administration</title>
<link href="~/CSS/AdaptStyle.css" rel="stylesheet" type="text/css" />
<link href="~/CSS/superfish.css" rel="stylesheet" type="text/css" />
<script src="../jQuery/jquery-1.5.1.min.js" type="text/javascript"></script>
<script src="../jQuery/superfish-1.4.8/js/hoverIntent.js" type="text/javascript"></script>
<script src="../jQuery/superfish-1.4.8/js/superfish.js" type="text/javascript"></script>
a maybe silly suggestion but i have to write it.
Have you tried setting all the files into one folder folder and after declaring the jquery run a $('some element').hide(); on $(document).ready(function () { }
to check that jquery is working (or loaded). my guess is that it is not loaded or its loaded twice (in which case you should correct that).
i hope that made some sense!
Have you tried setting all the files into one folder folder and after declaring the jquery run a $('some element').hide(); on $(document).ready(function
to check that jquery is working (or loaded). my guess is that it is not loaded or its loaded twice (in which case you should correct that).
i hope that made some sense!
ASKER
Chandra,
Why I ref the CSS folder using .. and ~ when ref jQuery? I tried using ~ for jQuery then I get error. Or using .. for CSS folder I also get error. The Master page is in the solution root in the tree. The CSS and jQuery folders are off the root of the tree. Why can't I just ~ for ref both folders?
I figure out why my jQuery code not working. When jQuery is done in Master/content then jQuery cannot ref the name of a asp.net web control any more. #lsAPExerciseOptions and #lbOtherExercise.... are no longer valid. However, I can't remember how to ref each web control any more in jQuery when Master/content pages are at play. Do anyone of you know how to do this? Thanks.
Why I ref the CSS folder using .. and ~ when ref jQuery? I tried using ~ for jQuery then I get error. Or using .. for CSS folder I also get error. The Master page is in the solution root in the tree. The CSS and jQuery folders are off the root of the tree. Why can't I just ~ for ref both folders?
I figure out why my jQuery code not working. When jQuery is done in Master/content then jQuery cannot ref the name of a asp.net web control any more. #lsAPExerciseOptions and #lbOtherExercise.... are no longer valid. However, I can't remember how to ref each web control any more in jQuery when Master/content pages are at play. Do anyone of you know how to do this? Thanks.
ASKER
Thank you.
ASKER
I also did installed the Firebug and when I select items in the 2 selectbox that supposed to triger the javascript/jquery code and I saw no error there either.
Thank you.