Hi,

is there some way how to force asp.net (C#) webpage wait with other orders in code? I mean something like this:

1 - make something
2 - wait 5 seconds (for completing previous tasks)
3 - continue with other orders

Thanks,
Stivi

Recommended Answers

All 6 Replies

Sorry, but this doesn't make sense to me. Can you post a better pseudo-code example? If you have something that needs to execute before something else happens, code the first "thing" as a method that returns a value. Test the value, then move forward or not.

There should never be a need to do what you're asking to do.

I agree. However should you need to pause the thread while another thread completes then use thread.sleep(timetosleep)

OK, I've already solved that, it was just an error in code... But however, I'll ask a different way - do we have something like timer in asp.net 2 ? Just if I want to refresh the page in some intervals?

Page refreshing would be a client-side issue. You'd use JavaScript for that.

so you want to auto refresh the page at set times?
Best way to do it is to put it in the META tag. It is the same technique as an auto redirect to another page, only this time you are reloading your own page.

You can either code this in the markup when you design it or you can add it later in code when you want it.

in code you need to add the following line
Response.Write("<Meta http-equiv='REFRESH' content='20;URL=mypage.aspx' />");

and in markup you just need
<Meta http-equiv='REFRESH' content='20;URL=mypage.aspx' />

the 20 means 20 seconds, so put your own time in there. It is as simple as that

Threading.Thread.Sleep(5000)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.