Solved

spinning wheel with update panel

Posted on 2011-02-15
6
1,574 Views
Last Modified: 2012-05-11
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

0
Comment
Question by:scm0sml
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 10

Expert Comment

by:John Claes
ID: 34895726
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
0
 

Author Comment

by:scm0sml
ID: 34895745
OK I'd appreciate an example!! Thanks in advance.
0
 
LVL 10

Expert Comment

by:John Claes
ID: 34895766
Ok :

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

http://www.codeproject.com/script/Articles/ArticleVersion.aspx?aid=35061&av=6251
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Expert Comment

by:John Claes
ID: 34895781
And this was the other Source of my Code :

http://www.codeproject.com/KB/aspnet/PleaseWaitButton_ASPNET.aspx
0
 
LVL 10

Accepted Solution

by:
John Claes earned 500 total points
ID: 34895832
WHat happens  :


The button's onclick is altered so 2 things hapepn instead of only the Call to the Server
The call is performed and then the javascript will show the Waiting image and disable all controls....


When the Callback (server-side) is done the page will refresh itself to show the server-side answer and the waiting image will be hiden again.

you can write this very easly yourself, but then you have to add it everywhere yourself.

regards

poor beggar


0
 

Author Comment

by:scm0sml
ID: 34896055
I wrote it myself in the end as it is only needed in the one place but thank you for the idea!!
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question