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

loading panel displayed after canceling partial postback.

1 Answer 59 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Dean
Top achievements
Rank 1
Dean asked on 14 Oct 2011, 08:28 AM

A loading panel is displayed after canceling a partial postback in javascript on the PageRequestManagers InitalizeRequest event handler. How do I get rid of the loading panel?  Is there any other way to cancel the partial postback?

I have radio buttons in the command section of an ajaxified RadGrid.

<CommandItemTemplate>
  <asp:RadioButton ID="sortByDateOfEntryRadioButton" AutoPostBack="true" 
    OnCheckedChanged="ReOrderTimesheetItems"
    runat="server" Text="Order Of Entry" GroupName="TimesheetItemSortOrder" />
  
  <asp:RadioButton ID="sortByDateOfTimesheetItemDateRadioButton" AutoPostBack="true"
    OnCheckedChanged="ReOrderTimesheetItems" runat="server" Text="Timesheet Date/Time"
    GroupName="TimesheetItemSortOrder" />
</CommandItemTemplate>

I stop the partial post back that occurs when selecting a radio button if the form is dirty. using the javascript below.

The partial postback is sucessfully canceled on the line args.set_cancel(true) but the loading panel is still displayed.

function initRequest(sender, args) {
    var isSortingTimesheetItems = 
    ((args.get_postBackElement().id.indexOf("sortByDateOfTimesheetItemDateRadioButton") != -1)
    || (args.get_postBackElement().id.indexOf("sortByDateOfEntryRadioButton") != -1))
  
    if (isSortingTimesheetItems) {
        // this check has to be done here to stop the partial post back
        if (!FormIsDirty()) {
            args.set_cancel(true);  //stop async request
            return;
        
  }
}
  
function RegisterScriptManagerInitializeRequestEvent() {
    Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(initRequest);
}

How do I get rid of the loading panel?
Is there any other way to cancel the partial postback?

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 18 Oct 2011, 02:31 PM
Hello Dean,

Please try using the approach provided in the following help topic to cancel the ongoing AjaxRequest and verify if the LoadingPanel still appears:
http://www.telerik.com/help/aspnet-ajax/ajax-cancel-ajax-request.html

If this doesn't help please try to following approach and let me know what the result is:
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
    function RequstStart() {
        var obj = Sys.WebForms.PageRequestManager.getInstance();
        if (obj.get_isInAsyncPostBack())
            obj.abortPostBack();
    }
</script>
</telerik:RadCodeBlock>


Regards,
Maria Ilieva
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
Dean
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or