Ajax loading panel with service not working

2 posts, 0 answers
  1. Kevin
    Kevin avatar
    265 posts
    Member since:
    Jun 2011

    Posted 19 Jun 2014 Link to this post

    I am trying to get the Ajax loading panel to work with a service that when they pick a person it does some active directory look-ups and save them to a database.  But I cannot get the control working with a textbox that has a service in it.

    My text box has an autocomplete service in it that when they pick a name does a looup to AD then saves to DB.  Sometimes it takes quite a while for this to happen and I want to show a loading panel but it will not work with the service in there.  It blocks out my service.
    <form id="form1" runat="server">
           <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
           <telerik:RadAjaxManager ID="radmanager" runat="server">
                   <telerik:AjaxSetting AjaxControlID="txtName">
                           <telerik:AjaxUpdatedControl ControlID="txtName" LoadingPanelID="radLoad" />
               <div class="deletepg" >
                   <h4>Delete Exisitng Active Directory Account</h4>
                   <br />
                   Find User: <asp:TextBox ID="txtName" runat="server" Width="260px" AutoPostBack="true"></asp:TextBox>
                   <asp:AutoCompleteExtender ID="txtName_ACE" runat="server" DelimiterCharacters="" Enabled="True" ServicePath="~/iMACService.asmx"  ServiceMethod="FindName"
                   TargetControlID="txtName" UseContextkey="true" MinimumPrefixLength="3" OnClientItemSelected="Selected" EnableCaching="true" CompletionInterval="1" />
                   <asp:TextBoxWatermarkExtender ID="txtName_WME" runat="server" TargetControlID="txtName" WatermarkText="Enter Last Name First Name" WatermarkCssClass="WaterMark" />
               <asp:HiddenField ID="HFPersId" runat="server" /><asp:HiddenField ID="HFUserId" runat="server" />
               <telerik:RadAjaxLoadingPanel ID="radLoad" runat="server" BackgroundPosition="Center" Direction="RightToLeft" MinDisplayTime="3000"></telerik:RadAjaxLoadingPanel>
    Protected Sub txtName_TextChanged(sender As Object, e As EventArgs) Handles txtName.TextChanged
           If HFPersId.Value = String.Empty Then
               ScriptManager.RegisterClientScriptBlock(Page, GetType(Page), "OpenWindow", "alert('You must pick a user to delete.');", True)
           End If
       End Sub
    Private Sub VerifyInfo()
           Dim VReturn As String = String.Empty
           Dim mac As String = String.Empty
           mac = CreateMacNum()
           sql = "execute usp_DeleteUser " & Convert.ToInt32(HFPersId.Value) & ", " & Convert.ToInt32(HFUserId.Value) & ", '" & mac & "'"
           VReturn = getData(sql).Rows(0)(0).ToString
           If VReturn = "0" Then
               ScriptManager.RegisterClientScriptBlock(Page, GetType(Page), "OpenWindow", "alert('User has already been deleted from Active Directory and all local data tables have been updated.');", True)
           ElseIf VReturn = "1" Then
               ScriptManager.RegisterClientScriptBlock(Page, GetType(Page), "OpenWindow", "alert('A current MAC has been submitted for user. This MAC must be closed before submitting another.');", True)
           ElseIf VReturn = "2" Then
               ScriptManager.RegisterClientScriptBlock(Page, GetType(Page), "OpenWindow", "alert('User has been submitted for Deletion from Active Directory.');", True)
               ScriptManager.RegisterClientScriptBlock(Page, GetType(Page), "OpenWindow", "alert('Something happened with the deletion process.  Please put in a HDT with error.');", True)
           End If
       End Sub
  2. Viktor Tachev
    Viktor Tachev avatar
    2407 posts

    Posted 24 Jun 2014 Link to this post

    Hello Kevin,

    Thank you for contacting us.

    When updating the text in a TextBox control using a WebService you could show and hide the RadAjaxLoadingPanel explicitly. The loading icon would be shown when the data is requested and will be hidden when it is returned from the service. For example you could hide the panel in the success method. Please note that this approach does not require the use of RadAjaxManager.

    For your convenience I am attaching a sample project illustrating how you could show and hide the RadAjaxLoadingPanel on the client with no postback. In the sample there are two buttons used. In your scenario you could call the showPanel() function when you are requesting data from the service. The hidePanel() would be called when the data is returned.

    Give this approach a try and let me know how it works for you.

    Viktor Tachev

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top