Page.ClientScript question about Javascript

  • Thread starter Thread starter First Last
  • Start date Start date
F

First Last

Hi,
Newbie question: Why use Page.ClientScript.RegisterClientScript*
when we can just make a .js file and include a reference to it in the page?
(i.e. <script src="myscript.js" type="text/javascript"></script>)

Is it because RegisterClientScript* enables us to reference ASP.NET
objects within the .js?

Thx,
Hank
 
The purpose would be to add the reference at runtime instead of design time.
If you know the details of the JavaScript file at design time it would be
best to declare it then, otherwise you'd be pretty much forced to use
RegisterClientScript.
 
it mainly for controls that spew javascript. they can not edit the page
text.

-- bruce (sqlwork.com)
 

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