470,620 Members | 1,606 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,620 developers. It's quick & easy.

Server-side command included in javascritp inside codebehind??

al
Greetings,

I'm having a problem trying to execute server-side command included in
javascript inside codebehind file (VB.net).
'*****code sample
Button1.attributes.add("onclick"," '" & <%response.write(""test"")%>
& "' ")

This gives me javascript error?!?!?!??

Any help with the syntax of such case???

MTIA,
Grawsha
Nov 18 '05 #1
3 1135
Hi,
Lose the response.write. Eg
Button1.attributes.add("onclick", test)
for example
Dim test As String = "alert('test');"
YourButton.Attributes.Add("onclick", test)

Cheers,
Jon

"al" <gr*********@yahoo.com> wrote in message
news:66**************************@posting.google.c om...
Greetings,

I'm having a problem trying to execute server-side command included in
javascript inside codebehind file (VB.net).
'*****code sample
Button1.attributes.add("onclick"," '" & <%response.write(""test"")%>
& "' ")

This gives me javascript error?!?!?!??

Any help with the syntax of such case???

MTIA,
Grawsha

Nov 18 '05 #2
You can't execute server commands from the browser. Read up on the difference between serverside and clientside programming. www.w3schools.com is a good place for javascript.

"al" wrote:
Greetings,

I'm having a problem trying to execute server-side command included in
javascript inside codebehind file (VB.net).
'*****code sample
Button1.attributes.add("onclick"," '" & <%response.write(""test"")%>
& "' ")

This gives me javascript error?!?!?!??

Any help with the syntax of such case???

MTIA,
Grawsha

Nov 18 '05 #3
al
Scott Simons <Scott.Simons.At.MealMagic.Com.Remove.This> wrote in message news:<AD**********************************@microso ft.com>...
You can't execute server commands from the browser. Read up on the difference between serverside and clientside programming. www.w3schools.com is a good place for javascript.

"al" wrote:
Greetings,

I'm having a problem trying to execute server-side command included in
javascript inside codebehind file (VB.net).
'*****code sample
Button1.attributes.add("onclick"," '" & <%response.write(""test"")%>
& "' ")

This gives me javascript error?!?!?!??

Any help with the syntax of such case???

MTIA,
Grawsha


Ok, what about this syntax(inside JS):

<%response.write(""test"")%>, or
<%response.redirect(""main.aspx"")%>

I thought it is used for executing server side code????

Grawsha
Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Nathan Sokalski | last post: by
9 posts views Thread by Grim Reaper | last post: by
14 posts views Thread by Developer | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.