| Author |
client vs server side
|
|
| rodchar 2005-11-29, 7:03 pm |
| 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
| |
| Charles 2005-11-29, 7:03 pm |
| 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.
| |
| rodchar 2005-11-29, 9:57 pm |
| thank you.
"Charles" wrote:
> 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.
>
>
| |
| Eliyahu Goldin 2005-11-30, 4:00 am |
| or am i too tired?
Likely.
Eliyahu
|
|
|
|