Ask a Question related to ASP.NET General, Design and Development.
-
Susan van Houen #1
autopostback - javascript intercept and cancel
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
Susan van Houen Guest
-
How to intercept property changes in subclassed control?
I've got an application that uses constants stored in XML files (see attached). The XML files are loaded into mx:Models and used as dataProviders on... -
Intercept when my control dropped on a WebForm
Hi All! I need to intercept the event when my control dropped on a WebForm (or manually added by changin page's source HTML). I know about... -
HttpWebResponse intercept raw HTTP?
For diagnostic and learning purposes, I would like to intercept and log the raw HTTP headers and content from a HttpWebResponse in a webservice. ... -
How to intercept an event in ASP.NET?
You can override the RaisePostBackEvent method of the Page class. The first parameter sent to this method is the object that caused the postback.... -
WEBFORM: can I intercept Back and...
Roby, HTTP is connectionless. Therefore, you have no way of intercepting client-side events from server-side code. Jim Cheshire Developer... -
Sreejumon[MVP] #2
autopostback - javascript intercept and cancel
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
>-----Original Message-----
>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
>
>
>.
>Sreejumon[MVP] Guest
-
Marina #3
Re: autopostback - javascript intercept and cancel
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.
"Susan van Houen" <svhouen@hotmail.com> wrote in message
news:uEdR89JTDHA.2196@TK2MSFTNGP12.phx.gbl...side> Thank you for your response, but I can't get it to work.
>
> My control looks like this
> <asp:dropdownlist id="ddlPoi" style="Z-INDEX: 125; LEFT: 32px; POSITION:
> absolute; TOP: 445px" runat="server"
> OnSelectedIndexChanged="lbLocoptions_SelectedIndex Changed"
> AutoPostBack="True">
>
> When OnSelectedIndexChanged is fired I want it to pass through a client> javascript where I can evaluate if I actually want the autopostback to
> complete or not.
>
> In the Page_Load of the behind code I have
>
> lbLocoptions.Attributes.Add("onselectedindexchange d", "return
> lbLocoptions_onchange();")
>
> and in the client I have
>
> function lbLocoptions_onchange(){
> return false;
> }
>
> Still, the AutoPostBack completes every time.
>
> Sincerely,
> S
>
> "Sreejumon[MVP]" <sreeju_uss@hotmail.com> wrote in message
> news:016301c34c9b$1faf4d50$a601280a@phx.gbl...>> > 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
> >
> >> > >-----Original Message-----
> > >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
> > >
> > >
> > >.
> > >
>
Marina Guest



Reply With Quote

