Register Javascript File

S

shapper

Hello,

I want to register the JQuery Javascript file at runtime in my Page's
VB code.

Do I need or should I to do this using ScriptManger? If not, how can I
do it?

Thanks,
Miguel
 
M

Mick Wilson

You want this, I think:

To elaborate (since I accidentally hit send), you can use the first
method listed on that page to register your script, and then set the
client onClick attribute (for example) to call a method from the
script.

Me.Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "chkAll",
stringOfJavaScript)

later on in the code...

Dim cbHeader As CheckBox = [...]
cbHeader.Attributes("onclick") = "MyJavaScriptFunction();"
 
W

wisccal

In addition to what Mick suggested, I would also recommend you check
out the ClientScriptManager's RegisterClientScriptInclude method.
Since you want to include the file dynamically, using the
ClientScriptManager's methods is, I believe, the only route to go.

==========
Regards,
Steve
www.stkomp.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

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,233
Latest member
AlyssaCrai

Latest Threads

Top