This is a migrated thread and some comments may be shown as answers.

AJAX Call (like RadTooltip) & Real Submit event.

1 Answer 38 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Eim
Top achievements
Rank 1
Eim asked on 22 Feb 2012, 02:54 PM
Hi,
 I need to catch the submit event in order to show a user lock layer to avoid multiple user click.
 I tried different way, submit direct event, and in the last (in the hope was the right way) this:

In page.cs :
 protected override void OnLoad(EventArgs e) {
            base.OnLoad(e);
            ScriptManager.RegisterOnSubmitStatement(Page, Page.GetType(), "myPostbackHandler", "myPostbackHandler()");
        }
In page.aspx :
<script language="javascript" type="text/javascript">
        function myPostbackHandler() {
            ... code to show a layer, etc...
        }

In every way I did,  when an ajax call occurs like  mouse over a rad:tooltip control,  
the function myPostbackHandler or submit event is always call.

Is there a way to distinct these DIFFERENT (ajax call, real submit) action on client side  ?

Thanks a lot. 

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 24 Feb 2012, 10:01 AM
Hello,

I just answered your question in the support ticket you opened. I am also posting it here. If you have any further questions, please place them in the ticket, so that we avoid duplicate posts.

Here is how you can make it work. I did not notice differences with the behavior of this approach in different RadControls versions, so it should work for you too.
1) Attach the onsubmit event, as you suggested - through the ScriptManager
2) Inside it, set a minimal timeout, so that the request can be processed
3) Check if it is an ajax request through the get_isInAsyncPostBack() property of the PageRequestManager
4) If not, show the div
5) (optional) You could use a RadAjaxLoadingPanel and show it explicitly over the desired element in the page

For your convenience I am attaching a sample project demonstrating this approach (I did not add the Skins dll to keep the archive as small as possible but runnable at the same time). 


Regards,
Tsvetina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Ajax
Asked by
Eim
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or