Action after confirmation from client -- asp.net

  • Thread starter Thread starter sweetpotatop
  • Start date Start date
S

sweetpotatop

Hi,

I have an asp.net project written in C#

It has a list of records for users to delete and select. When user
click the "Delete" button, I would like to ask the user to confirm
before I proceed.

And I have something like this in my code
button1.Attributes.Add("onClick", "return confirm('Some Prompt');");

If the user says yes, I have to run the code in server, which will
delete the records.

My question is, how does the server-side code gets the return value of
the confirmation, which I believe on the client-side?

Please help. Your help would be greatly appreciated.
 
It doesn't. The confirmation should basically abort the whole process if the
user doesn't confirm. This will mean that the only way to actually get to
the postback stage is to return a true condition from the confirm. Otherwise
the postback won't occur and the code just won't get executed so there's no
need for you to try to get the values.
 
Back
Top