For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > November 2005 > client vs server side









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

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


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com