PC Review


Reply
Thread Tools Rate Thread

How can I execute Javascript from codebehind...

 
 
Hakan ÖRNEK
Guest
Posts: n/a
 
      13th Feb 2007
Hi ,
I register client scripts like this;
--------------------------------------------------------------------------
-----------
Public Sub CreateClientAlert(ByVal Message As String, ByVal objPage As
Page)
Dim StrScript As New StringBuilder("")
With StrScript
.Append("<script type=""text/javascript"">")
.Append(vbCrLf)
.Append(vbCrLf)
.Append("alert('" & Message & "');")
.Append(vbCrLf)
.Append("</script>")
End With
If Not
objPage.ClientScript.IsClientScriptBlockRegistered("AlertBox") Then
objPage.ClientScript.RegisterClientScriptBlock(Me.GetType,
"AlertBoX", StrScript.ToString)
End If
End Sub
--------------------------------------------------------------------------
-----------
but how can I execute javascipt from codebehind ? ( ex. from buttonclick
event....)
Thanks for all helps...

Hakan Örnek




 
Reply With Quote
 
 
 
 
Spam Catcher
Guest
Posts: n/a
 
      13th Feb 2007
"Hakan ÖRNEK" <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> but how can I execute javascipt from codebehind ? ( ex. from
> buttonclick event....)
> Thanks for all helps...


Technically speaking you can't execute Javascript from codebehind. But what
you can do is add a OnClick event handler to the output HTML and allow the
browser to execute javascript when the button is clicked :-)


So, in your button, add an "OnClick" attribute.
 
Reply With Quote
 
Larry Linson
Guest
Posts: n/a
 
      13th Feb 2007
**** you nigger lovin javascript fag; go and play elsewhere; this is a
VB newsgroup

 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      13th Feb 2007
Hakan,

You can using the register script methods set all kind of script on your
page.
However if you want to do a JavaScript Function in that, than you have of
course to include a function in that.
(it will be processed at client side by the way)

http://www.vb-tips.com/dbpages.aspx?...c-d6e69a3128ec

There is more on our website about this.

Cor

"Hakan ÖRNEK" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
> Hi ,
> I register client scripts like this;
> --------------------------------------------------------------------------
> -----------
> Public Sub CreateClientAlert(ByVal Message As String, ByVal objPage As
> Page)
> Dim StrScript As New StringBuilder("")
> With StrScript
> .Append("<script type=""text/javascript"">")
> .Append(vbCrLf)
> .Append(vbCrLf)
> .Append("alert('" & Message & "');")
> .Append(vbCrLf)
> .Append("</script>")
> End With
> If Not
> objPage.ClientScript.IsClientScriptBlockRegistered("AlertBox") Then
> objPage.ClientScript.RegisterClientScriptBlock(Me.GetType,
> "AlertBoX", StrScript.ToString)
> End If
> End Sub
> --------------------------------------------------------------------------
> -----------
> but how can I execute javascipt from codebehind ? ( ex. from buttonclick
> event....)
> Thanks for all helps...
>
> Hakan Örnek
>
>
>
>



 
Reply With Quote
 
Hakan Örnek
Guest
Posts: n/a
 
      13th Feb 2007
Hi ,
Thanks for all help. I' ll try with callback events...

Hakan...

"Cor Ligthert [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hakan,
>
> You can using the register script methods set all kind of script on your
> page.
> However if you want to do a JavaScript Function in that, than you have of
> course to include a function in that.
> (it will be processed at client side by the way)
>
> http://www.vb-tips.com/dbpages.aspx?...c-d6e69a3128ec
>
> There is more on our website about this.
>
> Cor
>
> "Hakan ÖRNEK" <(E-Mail Removed)> schreef in bericht
> news:(E-Mail Removed)...
>> Hi ,
>> I register client scripts like this;
>> --------------------------------------------------------------------------
>> -----------
>> Public Sub CreateClientAlert(ByVal Message As String, ByVal objPage As
>> Page)
>> Dim StrScript As New StringBuilder("")
>> With StrScript
>> .Append("<script type=""text/javascript"">")
>> .Append(vbCrLf)
>> .Append(vbCrLf)
>> .Append("alert('" & Message & "');")
>> .Append(vbCrLf)
>> .Append("</script>")
>> End With
>> If Not
>> objPage.ClientScript.IsClientScriptBlockRegistered("AlertBox") Then
>> objPage.ClientScript.RegisterClientScriptBlock(Me.GetType,
>> "AlertBoX", StrScript.ToString)
>> End If
>> End Sub
>> --------------------------------------------------------------------------
>> -----------
>> but how can I execute javascipt from codebehind ? ( ex. from
>> buttonclick
>> event....)
>> Thanks for all helps...
>>
>> Hakan Örnek
>>
>>
>>
>>

>
>



 
Reply With Quote
 
Larry Linson
Guest
Posts: n/a
 
      14th Feb 2007
and cor, it is correct that we cannot do vbScript.. right?

I've read that in a MS press book.. I just had to verify since I've
had some people disagree with me recently

THanks

-Larry Linson Jr

 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      14th Feb 2007
Larry,

I really don't know, sorry
However, in my idea you should forget VBScript on webbrowser clientside, it
was usable in an ASP page on server side. I hope those people don't mix this
up.

Cor

"Larry Linson" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
> and cor, it is correct that we cannot do vbScript.. right?
>
> I've read that in a MS press book.. I just had to verify since I've
> had some people disagree with me recently
>
> THanks
>
> -Larry Linson Jr
>



 
Reply With Quote
 
Bruce W. Darby
Guest
Posts: n/a
 
      14th Feb 2007
Larry,

You seem to be a bit mistaken in your assumption. If you google for VBScript
and Clientside, there's tons of stuff available. Case in point...

http://www.tek-tips.com/viewthread.c...1318580&page=7

Bruce

"Cor Ligthert [MVP]" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Larry,
>
> I really don't know, sorry
> However, in my idea you should forget VBScript on webbrowser clientside,
> it was usable in an ASP page on server side. I hope those people don't mix
> this up.
>
> Cor
>
> "Larry Linson" <(E-Mail Removed)> schreef in bericht
> news:(E-Mail Removed)...
>> and cor, it is correct that we cannot do vbScript.. right?
>>
>> I've read that in a MS press book.. I just had to verify since I've
>> had some people disagree with me recently
>>
>> THanks
>>
>> -Larry Linson Jr
>>

>
>



 
Reply With Quote
 
pfc_sadr@hotmail.com
Guest
Posts: n/a
 
      14th Feb 2007

Cor

now why should we forget VB on the clientside?

VB WON THE WAR, IDIOT

WHY DID MICROSOFT THROW THE CROWN TO SUN?

SUN DID NOT WIN, VB WAS THE WORLDS MOST POPULAR LANGUAGE

WHY DID MICROSOFT TAKE A DIVE????

I WILL NOT SURRENDER ANOTHER INCH TO MICROSOFT

VB STICKS AROUND OR ELSE






On Feb 13, 11:09 pm, "Cor Ligthert [MVP]" <notmyfirstn...@planet.nl>
wrote:
> Larry,
>
> I really don't know, sorry
> However, in my idea you should forget VBScript on webbrowser clientside, it
> was usable in an ASP page on server side. I hope those people don't mix this
> up.
>
> Cor
>
> "Larry Linson" <larrylinso...@hotmail.com> schreef in berichtnews:(E-Mail Removed)...
>
>
>
> > and cor, it is correct that we cannot do vbScript.. right?

>
> > I've read that in a MS press book.. I just had to verify since I've
> > had some people disagree with me recently

>
> > THanks

>
> > -Larry Linson Jr- Hide quoted text -

>
> - Show quoted text -



 
Reply With Quote
 
pfc_sadr@hotmail.com
Guest
Posts: n/a
 
      14th Feb 2007
bruce

you really are a ****ing idiot aren't you?

IT IS NOT SUPPORTED IN ASP.NET
IT IS NOT SUPPORTED IN ASP.NET
IT IS NOT SUPPORTED IN ASP.NET
IT IS NOT SUPPORTED IN ASP.NET


I HAVE BEEN USING IT IN VB FOR MOTHER ****ING YEARS, DIPSHIT AND I AM
****ED OFF THAT ASP.NET DOES NOT SUPPORT IT.

IF ASP.NET _DOES_ SUPPORT VBSCRIPT CLIENTSIDE, THEN I DEMAND THAT
MICROSOFT MAIL ME A NEW EDITION OF ALL OF MY MS PRESS BOOKS BECAUSE I
HAVE IT IN WRITING, FROM MS PRESS THAT VBSCRIPT IS NOT SUPPORTED IN
ASP.NET

AND KILLING CLIENTSIDE VBSCRIPT IS MOTHER ****ING NOT ACCEPTABLE






On Feb 13, 11:20 pm, "Bruce W. Darby" <kraco...@atcomcast.net> wrote:
> Larry,
>
> You seem to be a bit mistaken in your assumption. If you google for VBScript
> and Clientside, there's tons of stuff available. Case in point...
>
> http://www.tek-tips.com/viewthread.c...1318580&page=7
>
> Bruce
>
> "Cor Ligthert [MVP]" <notmyfirstn...@planet.nl> wrote in messagenews:%(E-Mail Removed)...
>
>
>
> > Larry,

>
> > I really don't know, sorry
> > However, in my idea you should forget VBScript on webbrowser clientside,
> > it was usable in an ASP page on server side. I hope those people don't mix
> > this up.

>
> > Cor

>
> > "Larry Linson" <larrylinso...@hotmail.com> schreef in bericht
> >news:(E-Mail Removed)...
> >> and cor, it is correct that we cannot do vbScript.. right?

>
> >> I've read that in a MS press book.. I just had to verify since I've
> >> had some people disagree with me recently

>
> >> THanks

>
> >> -Larry Linson Jr- Hide quoted text -

>
> - Show quoted text -



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Codebehind vs inline javascript JJ Microsoft ASP .NET 1 28th Jul 2006 02:09 PM
javascript in codebehind John Lindemann via .NET 247 Microsoft C# .NET 0 2nd Jun 2005 05:25 PM
javascript from codebehind Rick Morayniss Microsoft ASP .NET 2 31st Mar 2004 10:11 PM
Getting variable of the codebehind in the JavaScript =?Utf-8?B?VmFydW4=?= Microsoft Dot NET 4 6th Mar 2004 09:41 AM
Execute a CodeBehind function from a javascript =?Utf-8?B?TWljaGFlbCBTTA==?= Microsoft ASP .NET 1 19th Feb 2004 04:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:11 PM.