autopostback - javascript intercept and cancel

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
 
S

Sreejumon[MVP]

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
 
M

Marina

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.
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top