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

Ajax loading panel with service not working

1 Answer 69 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 19 Jun 2014, 08:57 PM
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">
           <AjaxSettings>
               <telerik:AjaxSetting AjaxControlID="txtName">
                   <UpdatedControls>
                       <telerik:AjaxUpdatedControl ControlID="txtName" LoadingPanelID="radLoad" />
                   </UpdatedControls>
               </telerik:AjaxSetting>
           </AjaxSettings>
       </telerik:RadAjaxManager>
           <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" />
           </div>
           <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>
   </form>
 
 
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)
           ClearPage()
       Else
           VerifyInfo()
       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)
       Else
           ScriptManager.RegisterClientScriptBlock(Page, GetType(Page), "OpenWindow", "alert('Something happened with the deletion process.  Please put in a HDT with error.');", True)
       End If
 
       ClearPage()
   End Sub

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 24 Jun 2014, 11:09 AM
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.

Regards,
Viktor Tachev
Telerik
 

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.

 
Tags
Ajax
Asked by
Kevin
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or