Solved

spinning wheel with update panel

Posted on 2011-02-15
6
1,533 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
  • 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now