pop up confirmation help me please

  • Thread starter Thread starter graphicsxp
  • Start date Start date
G

graphicsxp

Hi,
I have a function in my code-behind (vb.net) that checks if the file
the user is trying to upload already exists on the server. At that
point I'd like to display a pop up saying 'Are you sure you want to
overwrite the existing file?'. If the user clilcks yes, the function
carries on.

How can I do that? How can I display a javascript popup at that point
of the execution and get the value returned by that popup ?

I'm really struggling on this :(

Thank you
 
Hi,
I have a function in my code-behind (vb.net) that checks if the file
the user is trying to upload already exists on the server. At that
point I'd like to display a pop up saying 'Are you sure you want to
overwrite the existing file?'. If the user clilcks yes, the function
carries on.

How can I do that? How can I display a javascript popup at that point
of the execution and get the value returned by that popup ?

I'm really struggling on this :(

Thank you

You can't (as you found out) just show a popup in the middle of
server-side code.

You will need to remember the file server side, redirect to a "are you
sure" page and either remove the stored copy or overwrite the existing
file based on the reaction there (you might also consider giving a new
name).

Server side copy: either a temporary file (but: you will want to
provide some mechanism to delete old copies - as when you never
received an answer to the "are you sure" page), or a Byte[] in Session
(but: this might be big!)

Hans Kesting
 
Write the file to a temporary file on your server, then send back your
response asking them if they wish to overwrite. If they do just delete the
old and move the new.
 
Sorry - ignore my earlier reply - didn't read your OP properly.

Go with Hans' suggestion...
 
But yet I was told it is possible to do it in javascript using hidden
fields and stuff like that... have you heard of this ?
 
But yet I was told it is possible to do it in javascript using hidden
fields and stuff like that... have you heard of this ?

Think about it:

JavaScript runs client-side i.e. on the user's machine.

How can it possibly know whether a file exists on the remote (web)server or
not...?
 
no i was not talking about that. you obviously detect that in the code
behind. But then there should be a way to do a postback and display a
javascript confirmbox, get the answer, and do appropriate action
(upload or not the file)
 
no i was not talking about that. you obviously detect that in the code
behind. But then there should be a way to do a postback and display a
javascript confirmbox, get the answer, and do appropriate action
(upload or not the file)

Of course, and that's what's been suggested - you just can't do it all in
one single postback... :-)
 
not to muddy the waters...but wouldn't Ajax work for this scenario? , but of
course that has its own issues

Jose
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top