client vs server side

G

Guest

hey all,

on page_load if i add the onclick attribute to a button and run it. which
will run first the client-side script or the server-side script. my guess was
client-side but when i debug it it stops on server-side and then it goes to
client-side. or am i too tired?

thanks,
rodchar
 
C

Charles

You can easily check by viewing source on the rendered button. If i
remember correctly ASPNET will append to the attribute the callback
function. So it would be onclick="yourstuff;dopostback();". So if you
want to cancel the click you can just return null from your script and
that ends the onclick event, just like returning a value from a
function ends it. Your better off checking this though. If you want to
do a confirmation though button.Attributes.Add("onclick", "return
confirm('are you sure?');"); works.
 

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

Top