Server-side command included in javascritp inside codebehind??

A

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
 
J

Jon Spivey

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
 
G

Guest

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.
 
A

al

Scott Simons said:
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.

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
 

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,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top