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
lapuccaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

stergiumCommented:
hello. i guess your problem is in the addnewpatient.aspx.
have you tried declaring the jquery paths there also?
this is my first quick  observation. when i have to hunt down javascript errors a good way for me is firefox with firebug installed. it usually gives me a good idea of what is wrong.
hope that helps

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lapuccaAuthor Commented:
Hi, Yes, i did try adding the jquery links path in addnewpatient.aspx in the Head content section (<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">)
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.
chandrasekar1Commented:
Please update the following code in Masterpage.master and try

  <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>

Open in new window


and also remove the ScriptManager from master page and place it in content pages where ever you needed. this will improve the performance little.

 <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
        </asp:ToolkitScriptManager>

Open in new window

Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

lapuccaAuthor Commented:
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.
//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>

Open in new window

stergiumCommented:
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!
lapuccaAuthor Commented:
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.
lapuccaAuthor Commented:
Thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.