User control with Javascript function

  • Thread starter Thread starter Lukas Kurka
  • Start date Start date
L

Lukas Kurka

Hi,

I have an User Control which uses css and javascript files. How should I add
them to the main page? When I place this User Control twice on the page, how
to add reference to these files only once.

Thanks
Lukas
 
Why don't you add the links to the javascript and css files to the
containing page?
 
you can use RegisterClientScriptBlock to include the javascript, either the
actual code or link. The style is more difficult. most control just have a
property to set the class name, and don't worry about defining the class.

you could write a style control, that allowed your user control to register
their css links.

-- bruce (sqlwork.com)
 
I will probably do it this way. I just wanted to make my code more
understandable, this way adding the user control is not enough, you have to
know that you must add this javascript and css reference as well.

Lukas
 

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