When I keep my reference to jquery and other javascript code and tags out side of the ContentPlaceholder in master page then jquery works but not inside it. but the problem is that when I keep the javacript script tags outside of the contentplaceholder then the the error saying invalid code blacks <% %> appears.. What to do? I used Scriptmanager to load jquery but no use..
Asked
Active
Viewed 270 times
0
-
Why negative mark?? what do you see wrong?? can you answer me? – Spirals Whirls Apr 13 '13 at 08:35
-
2Please, provide some code. – fedosov Apr 13 '13 at 09:01
-
The requirement to put the javascript in ContentplaceHolder was to avoid the <% %> code block error which occurred due to <%= %> statement. I changed the <%# %> to this instead and the issue removed and then took the javascript out side of ContentPlaceHolder but did not understand why Jquery did not load in ContentPlaceholder.. – Spirals Whirls Apr 13 '13 at 11:42
1 Answers
0
try this before/outside content holder
<script src="<%# Page.ResolveUrl("~")%>jquery/jq.js" type="text/javascript"></script>

Ratna
- 2,289
- 3
- 26
- 50
-
lol.. I did this before no use.. lately I changed the <%= %> statement to <%# %> instead and put the Javascript code outside of the ContentPlaceHolder which removed the <% %> code block error.. and the jquery started to work but I did not resolve the issue of why jquery did not work in contentplaceholder.. – Spirals Whirls Apr 13 '13 at 11:39
-
for answering i will need to view your master page code and a sample page – Ratna Apr 13 '13 at 11:53
-
i think because all javascript files should be loaded before everything else. Moving the links inside the contentplace holder moves the files inside your body tag. To place the files in head section u must use before contentplace holder. – Ratna Apr 13 '13 at 11:57
-
for details http://stackoverflow.com/questions/731407/proper-way-to-use-jquery-when-using-masterpages-in-asp-net – Ratna Apr 13 '13 at 11:57
-
Thanks seems this is something local causing the trouble .. because I have tried all these solutions nothing is working.. – Spirals Whirls Apr 13 '13 at 14:34