"K Viltersten" <(E-Mail Removed)> wrote in news:7h4urgF2s65drU1
@mid.individual.net:
> When i design a web user control, i usually
> put everything in a div, like this:
>
> <@ control ...>
> <div> ... </div>
>
> Now, i need to do some tricks with jQuery,
> which requires me to reference some JS-files
> but i'm not sure where to do so.
>
> Usually, i'd put the references in <head>
> but how do i do that when there's no such
> tag (as in the case with user control)?
>
> I tried to simply putting the <head> tag in
> "by brute force" but regrettably, i didn't
> get the behavior i expected.
>
There are two basic options here:
1. Register client side scripts (or startup scripts)
2. include in head of page or master page
The option you choose depends on a few factors. If this is a commercial
control, you are probably better to register the scripts, but leave an
option to turn this off, as a user may already be using jQuery for
something else (as Microsoft is heavily pushing it).
If this is not commercial, you have choices. If jQuery is used
throughout the site, put it in the master page. If only on a few pages,
you can put it in the head section of the page. If the page inherits
from a master page, you can still register in the head if you have a
head content region (the default since 2.0).
Peace and Grace,
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Twitter: @gbworld
Blog:
http://gregorybeamer.spaces.live.com
My vacation and childhood cancer awareness site:
http://www.crazycancertour.com
*******************************************
| Think outside the box! |
*******************************************