473,419 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

How can I execute Javascript from codebehind...

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


Feb 13 '07 #1
11 9399
"Hakan ÖRNEK" <or****@gmail.comwrote in
news:en**************@TK2MSFTNGP03.phx.gbl:
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.
Feb 13 '07 #2
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" <or****@gmail.comschreef in bericht
news:en**************@TK2MSFTNGP03.phx.gbl...
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


Feb 13 '07 #3
Hi ,
Thanks for all help. I' ll try with callback events...

Hakan...

"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:Ok**************@TK2MSFTNGP04.phx.gbl...
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" <or****@gmail.comschreef in bericht
news:en**************@TK2MSFTNGP03.phx.gbl...
>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.IsClientScriptBlockRegistere d("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



Feb 13 '07 #4
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

Feb 14 '07 #5
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" <la***********@hotmail.comschreef in bericht
news:11**********************@v45g2000cwv.googlegr oups.com...
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

Feb 14 '07 #6
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]" <no************@planet.nlwrote in message
news:%2***************@TK2MSFTNGP05.phx.gbl...
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" <la***********@hotmail.comschreef in bericht
news:11**********************@v45g2000cwv.googlegr oups.com...
>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


Feb 14 '07 #7

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.comschreef in berichtnews:11**********************@v45g2000cwv.g ooglegroups.com...
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 -

Feb 14 '07 #8
bruce

you really are a fucking 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 FUCKING YEARS, DIPSHIT AND I AM
PISSED 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 FUCKING NOT ACCEPTABLE


On Feb 13, 11:20 pm, "Bruce W. Darby" <kraco...@atcomcast.netwrote:
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.nlwrote in messagenews:%2***************@TK2MSFTNGP05.phx.gbl ...
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.comschreef in bericht
news:11**********************@v45g2000cwv.googlegr oups.com...
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 -

Feb 14 '07 #9
Bruce,

I think I am not the only one who only once has used it once at client side.
All scripts in Ajax are in my idea in JavaScript.

(While I have written a lot VBScript for ASP serverside).

I don't even know if it still is working standard in ASPNET.

Cor

"Bruce W. Darby" <kr******@atcomcast.netschreef in bericht
news:f6******************************@comcast.com. ..
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]" <no************@planet.nlwrote in message
news:%2***************@TK2MSFTNGP05.phx.gbl...
>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" <la***********@hotmail.comschreef in bericht
news:11**********************@v45g2000cwv.googleg roups.com...
>>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



Feb 14 '07 #10
Thanks Cor,

Didn't know we were speaking about ASP.Net. On the MSDN site, Aaron did get
one right, but only half right...

http://msdn.microsoft.com/library/de...agechanges.asp

ASP.Net does not support VBScript, but a web application written in ASP
doesn't have to be completely rewritten in ASP.Net as both types of pages
can co-exist in a web application.

Bruce

"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Bruce,

I think I am not the only one who only once has used it once at client
side. All scripts in Ajax are in my idea in JavaScript.

(While I have written a lot VBScript for ASP serverside).

I don't even know if it still is working standard in ASPNET.

Cor

"Bruce W. Darby" <kr******@atcomcast.netschreef in bericht
news:f6******************************@comcast.com. ..
>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]" <no************@planet.nlwrote in message
news:%2***************@TK2MSFTNGP05.phx.gbl...
>>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" <la***********@hotmail.comschreef in bericht
news:11**********************@v45g2000cwv.google groups.com...
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



Feb 14 '07 #11
ALL SCRIPTS IN ASP.NET ARE JAVASCRIPT?

YOU HIT THE NAIL ON THE HEAD

WHY DOES MICROSOFT BOW DOWN TO A TINY ASS COMPANY THAT HAS NOT BEEN
RELEVENT FOR A DECADE

FUCK SUN FUCK JAVA AND FUCK MS IF THEY CANNOT TAKE VB SERIOUSLY


On Feb 14, 3:46 am, "Cor Ligthert [MVP]" <notmyfirstn...@planet.nl>
wrote:
Bruce,

I think I am not the only one who only once has used it once at client side.
All scripts in Ajax are in my idea in JavaScript.

(While I have written a lot VBScript for ASP serverside).

I don't even know if it still is working standard in ASPNET.

Cor

"Bruce W. Darby" <kraco...@atcomcast.netschreef in berichtnews:f6******************************@comca st.com...
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.nlwrote in message
news:%2***************@TK2MSFTNGP05.phx.gbl...
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.comschreef in bericht
news:11**********************@v45g2000cwv.googleg roups.com...
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 -

Feb 14 '07 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Allan M. | last post by:
I have a series of select boxes that must be populated client side, because they interact with each other. The design specification calls for these boxes to be updated without having to make a...
2
by: Alex | last post by:
Hi all, I'm writing a small web application which searches a database based on a date field, and populates a datagrid control with the results. The datagrid control has selection buttons added...
1
by: Michael SL | last post by:
Here is my problem. I have a delete record button. I want to prompt the user "Do you really want to delete?". If the user clicks 'OK' then I want to execute the CodeBehind on the server side to...
2
by: Ekken Zuiber | last post by:
hiye people, i know this have been ask multipletimes over the past year, but i cant find any here in the new group so here goes.. in my code behind, i'm going to do some validation and use...
4
by: Rob Shorney | last post by:
Hi, I am using .Net 2003 , c# asp.net. The situation i have is this. I have a asp.net page which in the codebehind maintains an xml document in memory. The user can click on a button to popup a...
1
by: Jorge Ponte | last post by:
hi I have a Web User Control (ascx) - lets call it "My_WUC" - in a Web form. In that WUC I want have a textbox and a button. I want to click on the button and open a popup (I use javascript for...
4
by: Mark Miller | last post by:
I've been trying to execute a javascript function just before submit on a form that contains an <input type="file"> input field and it isn't working. The reason I want to do this is the end users...
6
by: simon | last post by:
hello, what code would i use to kick off a javascript script after i had registered it? If (Not Page.IsClientScriptBlockRegistered("jsScript")) Then Page.RegisterClientScriptBlock("jsScript",...
4
by: archana | last post by:
Hi all, i am having one user control. what i want is to add javascript which will gets called on button click of user control. but user control is not working if i add javascript in user...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.