0

I would like the page to load, then I will display a GIF that's LOADING DATA and then I want this loop (see below) to run until the row count is not 0.

(An SQL job has been triggered in the previous page which takes about 1 - 2 minutes to run and so I want to display the new data automatically when it appears in the database.)

I can't figure out how to programmatically get this to work, I understand that because I have this in the page_load it will run before the page loads but I'm not sure how to run it after the page has loaded

Any help, advice or tips are very welcome Thank you

Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs)
    Do While GridView1.Rows.Count = 0 And GridView2.Rows.Count = 0
        GridView1.DataBind()
        GridView2.DataBind()
    Loop
End Sub
1
  • I think you need to learn about the page life-cycle in ASP.NET, and in particular the fact that the browser will NOT finish "loading" until all the page has been processed. As Chris hints at in his "answer", you should look at AJAX... either manually through jquery/javascript, or via the <asp:UpdatePanel> in ASP.NET Commented Jan 24, 2014 at 14:15

1 Answer 1

1

If using Ajax/JQuery, can you not use a timer control that posts back every seconds and as soon as there is data in both tables then disable the timer.

Sign up to request clarification or add additional context in comments.

2 Comments

Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs) Timer1.enabled = (GridView1.Rows == 0) || (GridView2.Rows == 0) End Sub
thanks a lot, I will consider implementing something like this

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.