Link to home
Start Free TrialLog in
Avatar of scm0sml
scm0sml

asked on

spinning wheel with update panel

Hi,

I have a search that I am doing that can take a few seconds to come back.

However it isn't blatently obvious that anything is happening so I want to use the spinning ajax wheel.

I have my code inside an <asp:updatepanel and want to display the wheel while the search is happening.

I have the code below but the wheels doesn't show which is fair enough.

How is this normally done?
Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click
        Dim suppliers As List(Of Supplier) = Nothing

        Try
            If txtSearchTerm.Text <> "" Then
                pnlWaiting.Visible = True 'this is where the wheel should become visible

                suppliers = New List(Of Supplier)

                suppliers = HelperGeneral.GetSuppliers(txtSearchTerm.Text)

                If suppliers.Count > 0 Then
                    rptSuppliers.DataSource = suppliers
                    rptSuppliers.DataBind()

                    lblResultCount.Text = "Found " & suppliers.Count & " Suppliers matching the search criteria."

                    pnlSupplierDisplay.Visible = True
                Else
                    lblResultCount.Text = "No Suppliers matching the search criteria."
                End If

                pnlWaiting.Visible = False 'and then where it is hidden again.
            End If
        Catch ex As Exception
            Throw
        End Try
    End Sub

Open in new window

Avatar of John Claes
John Claes
Flag of Belgium image

the issue is here that a redrawn only occures After the Javascript has finished working and then you already hidden the wheel again.

Thing is here that you should ensure the wheel is visible and giving a function to call when shown
Then when the wheel is shown it must call the given function.

I'll look in my archive for a code-example
Avatar of scm0sml
scm0sml

ASKER

OK I'd appreciate an example!! Thanks in advance.
Ok :

This might help faster :
I've taken my needed code from

http://www.codeproject.com/script/Articles/ArticleVersion.aspx?aid=35061&av=6251
ASKER CERTIFIED SOLUTION
Avatar of John Claes
John Claes
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of scm0sml

ASKER

I wrote it myself in the end as it is only needed in the one place but thank you for the idea!!