Solved

spinning wheel with update panel

Posted on 2011-02-15
6
1,541 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
@Html.EditorFor displays mm/dd/yyyy rather than date 2 31
C# GridRow get Old/New Value 1 55
Adjust the position 3 45
Json and asp.net mvc 2 43
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…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

943 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

18 Experts available now in Live!

Get 1:1 Help Now