Server-side command included in javascritp inside codebehind??

  • Thread starter Thread starter al
  • Start date Start date
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
 
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
 
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.
 
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

Back
Top