autopostback - javascript intercept and cancel

  • Thread starter Thread starter Susan van Houen
  • Start date Start date
S

Susan van Houen

Hi All,

How do I intercept an autopostback on the client side
and prevent it from executing the submit?

In classic ASP I used to intercept the on_submit and
just

return false;

but it doesn't seem to work anymore.

Any ideas?

Sincerely,
S
 
Hi Susan,

Please add the javascript function to your server control
as given below.
Button1.Attributes.Add("onclick", "return FunctionName
();");

Now put the function in html section. If success then you
can return true else false.

So it wont submit the page if client side function fails.

Let me know if you ned furtehr help.
Regards
Sreejumon
 
The reason that doesn't work, is because by setting AutoPostBack to true,
that generates an onselectedindexchanged handler, which just submits the
form. So the one you created, just get ignored.

I would instead suggested that you turn autopostback to false, and just keep
your handler. This handler should then sometimes manually submit the form by
calling its submit method.
 
Back
Top