1

I have a bit of a strange situation and I've not worked with .net before so unsure if this is possible.

I have a div that contains a form, when the form is submitted the div flips over.

My problem is that when the submit button is pressed the file upload occurs so the div doesn't flip.

What Im wondering is, can you delay the file upload for X seconds until the jQuery flip function has completed, and then upload the file?

3
  • What does this have to do with .NET? If you want to do something client-side before the form is submitted, do it with client-side scripting (aka javascript). Commented Oct 16, 2013 at 17:15
  • @MikeSmithDev I'm unsure what .net is capable of, maybe theres a delay function or something? Commented Oct 16, 2013 at 17:15
  • 2
    Well... .NET is server-side scripting, by the time you get there, the post-back has already occurred, and from what you've written, it sounds like you want to do something before post-back. Commented Oct 16, 2013 at 17:16

2 Answers 2

2

How about calling the file upload function asynchronously-ish with setTimeout? Calling it in an async-ish manner with a brief delay should allow your div to flip.

The code might look something like this:

setTimeout(function(){yourFileUploadFunction()}, 1);

See here for more js async detail. And here. Also here. There are a number of ways to use setTimeout to create an sync call...

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

Comments

1

Try to sleep a couple of seconds before processing the upload.

On the client side:

$("#upload").flip().delay(2000).ajax()

(not sure the exact syntax of what you're doing but this should get you close)

1 Comment

Adding a sleep on the server side won't do anything. Second option looks reasonable.

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.