Hi,
Is it possible to catch the ajaxRequestWithTarget (client side) in an eventhandler on the server side?
When I try to catch the normal ajaxRequest in an eventhandler everything works fine but when I use the ajaxRequestWithTarget function in my client code, I can't catch it. Do I have to do anything else or am I forgetting something.
Thanks
Bert
Is it possible to catch the ajaxRequestWithTarget (client side) in an eventhandler on the server side?
When I try to catch the normal ajaxRequest in an eventhandler everything works fine but when I use the ajaxRequestWithTarget function in my client code, I can't catch it. Do I have to do anything else or am I forgetting something.
Thanks
Bert
4 Answers, 1 is accepted
0
Hello Bert,
Typically this will raise the post back event of an IPostBackEventHandler exactly in the same way as with __doPostBack(). For a button for example ajaxRequestWithTarget() will raise button Click event.
You can catch globally at page level all post back events if you override RaisePostBackEvent() method:
protected override void RaisePostBackEvent(IPostBackEventHandler sourceControl, string eventArgument)
{
base.RaisePostBackEvent(sourceControl, eventArgument);
}
sourceControl argument is the Control which will raise post back event.
Greetings,
Vlad
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Typically this will raise the post back event of an IPostBackEventHandler exactly in the same way as with __doPostBack(). For a button for example ajaxRequestWithTarget() will raise button Click event.
You can catch globally at page level all post back events if you override RaisePostBackEvent() method:
protected override void RaisePostBackEvent(IPostBackEventHandler sourceControl, string eventArgument)
{
base.RaisePostBackEvent(sourceControl, eventArgument);
}
sourceControl argument is the Control which will raise post back event.
Greetings,
Vlad
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Bert
Top achievements
Rank 1
answered on 30 Jul 2008, 12:38 PM
Thanks for the fast reply.
There was just 1 thing that forgot to mention. It's not a page where I want to catch the event. It's in a usercontrol. In hereI think that I can't override the RaisepostBackEvent.
Is there a way to do this?
thanks
Bert
There was just 1 thing that forgot to mention. It's not a page where I want to catch the event. It's in a usercontrol. In hereI think that I can't override the RaisepostBackEvent.
Is there a way to do this?
thanks
Bert
0
Accepted
Hello Bert,
enerally UserControl does not implement IPostBackEventHandler. That is why, to achieve your goal you need to implement the following interface when needed. Here is the bare bone logic:
Best regards,
Stephen
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
enerally UserControl does not implement IPostBackEventHandler. That is why, to achieve your goal you need to implement the following interface when needed. Here is the bare bone logic:
public class WebUserControl1 : System.Web.UI.UserControl, IPostBackEventHandler |
{ |
public void RaisePostBackEvent(string eventArgument) |
{ |
} |
} |
Public Class WebUserControl1 |
Inherits System.Web.UI.UserControl |
Implements IPostBackEventHandler |
Public Sub RaisePostBackEvent(ByVal eventArgument As String) Implements System.Web.UI.IPostBackEventHandler.RaisePostBackEvent |
End Sub |
End Class |
Best regards,
Stephen
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Bert
Top achievements
Rank 1
answered on 30 Jul 2008, 01:08 PM
ok thanks for all