Register Javascript File

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
Shapper [ Mi, 16 April 2008 02:53 ] [ ID #1943399 ]

Re: Register Javascript File

On Apr 15, 8:53 pm, shapper <mdmo... [at] gmail.com> wrote:
> 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

You want this, I think:

http://msdn2.microsoft.com/en-us/library/system.web.ui.clien tscriptmanager.registerclientscriptblock.aspx
Mick Wilson [ Mi, 16 April 2008 16:20 ] [ ID #1943466 ]

Re: Register Javascript File

> You want this, I think:
>
> http://msdn2.microsoft.com/en-us/library/system.web.ui.clien tscriptma...

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();"
Mick Wilson [ Mi, 16 April 2008 16:26 ] [ ID #1943468 ]

Re: Register Javascript File

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

shapper wrote:
> 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
wisccal [ Do, 17 April 2008 12:21 ] [ ID #1944338 ]
Microsoft » microsoft.public.dotnet.framework.aspnet » Register Javascript File

Vorheriges Thema: Multiple File upload
Nächstes Thema: Re: setting textbox focus at the end of the text