client vs server side

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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.
 
Back
Top