How do I cope with client-side Javascript functions with master pages?

  • Thread starter Thread starter Alan Silver
  • Start date Start date
A

Alan Silver

Hello,

I am just converting some pages to use master pages, and I have come
across a bit of a problem. One of the pages uses some custom Javascript
functions for client-side validation.

Now, the <head> tag is entirely contained in the master. This means that
I could put the JS functions in the master, but then they would appear
on every page, which I don't want.

The only other way I can see of doing this would be to create an extra
ContentPlaceHolder in the master, and have it empty for every other
page. This seems the wrong way to do it.

Anyone any suggestions? TIA
 
Anyone any suggestions? TIA

In case it's of use to anyone, and to avoid others wasting their time
posting an answer, I found out that you don't have to have a content
control in the .aspx for every contentplaceholder in the master. This
means that I can add a contentplaceholder in the head of the master, and
then just this page (and any others that need JS) can define content
controls for it.

Simple really. If anyone has any better suggestions, please tell me, but
this is so simple that I can't imagine an easier way!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top