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)
 
Back
Top