Re: Decoupling javascript from UserControls
- From: "Gregory A. Beamer" <NoSpamMgbworld@xxxxxxxxxxxxxxxxxx>
- Date: Mon, 20 Jul 2009 07:23:28 -0700
Ole Viaud-Murat <o.viaudmurat@xxxxxxxxxxxxxx> wrote in news:7c87fac8-
2237-4c5e-95ab-29b9317ceff3@xxxxxxxxxxxxxxxxxxxxxxxxxxx:
Thank you so far.
But i dont understand you completely. I'm neither planning to change
the ajax js libs nor to the load-behaviour of those.
In some of our UserControls there are javascript blocks, for example
to handle certain events of commercial controls eg. the SelectedItem
Change of a ComponentArt ComboBox.
The problem is, that those js blocks are scattered throughout the html
response that is sent to the browser. And i want all of the JS to be
loaded from files, to remove them from the UserControl-Markup, to make
them cacheable for the client and to centralize all JS source.
I guess the main problem is, that i'm using constructs like
var el = $get('<%= tbSomeControl.ClientID %>');
Probably i should try to remove those Server-Side Client-ID generation
and get those a different way.
I dont know if i understood you wrong or if my question was unclear,
perhaps you know now what i mean?
For now, we have to stick to asp.net 3.5 in Forms mode, though we
consider using asp.net MVC in the near future.
If you are using third party controls, it gets more difficult. Some of
hte libraries use external files already, but many emit JavaScript, as
you have pointed out.
Can you consolidate? Certainly, but the calls are still going to be
emitted unless you can control the output (exposed or deriving your own
class from theirs, and it is possible neither will be supported).
I am not sure I see anything wrong with $get() except perhaps
maintainability.
Good luck on this one, as I am not sure there is an easy solution,
especially if you are attempting to consolidate numerous libraries. It
also sounds very custom.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com
*******************************************
| Think outside the box! |
*******************************************
.
- References:
- Decoupling javascript from UserControls
- From: Ole Viaud-Murat
- Re: Decoupling javascript from UserControls
- From: Gregory A. Beamer
- Re: Decoupling javascript from UserControls
- From: Ole Viaud-Murat
- Decoupling javascript from UserControls
- Prev by Date: Re: Decoupling javascript from UserControls
- Next by Date: Re: Body OnUnload ASP.NET Postback question
- Previous by thread: Re: Decoupling javascript from UserControls
- Next by thread: Virtual Earth inside Updatpanels disappears and wont work after po
- Index(es):
Relevant Pages
|