Conditional confirmation dialog

P

pardesiya

Hi Folks,

I have an aspx webform with several controls and a 'Save' button to
save product details. When the user clicks on the 'Save' button, my C#
code behind connects to a Sybase database (via oledb) and checks if a
product with the same name already exists. If it does't exist the code
inserts a new record. But if it does then I want to ask the user,
using a confirmation dialog or by some other means, if the product is
to be overwritten with the new details and then take appropriate
action.

I've searched high and low before posting this but cannot seem to find
a good solution.
Can anyone please advice how could I achieve this?

Thanks,
PD
 
G

Guest

pardesiya said:
Hi Folks,

I have an aspx webform with several controls and a 'Save' button to
save product details. When the user clicks on the 'Save' button, my C#
code behind connects to a Sybase database (via oledb) and checks if a
product with the same name already exists. If it does't exist the code
inserts a new record. But if it does then I want to ask the user,
using a confirmation dialog or by some other means, if the product is
to be overwritten with the new details and then take appropriate
action.

I've searched high and low before posting this but cannot seem to find
a good solution.
Can anyone please advice how could I achieve this?

What about this approach?

Put a label on the form, name it as Status. Once product is found, show an
error message (Status.Text) and wait if user wants to overwrite it, or not.

protected void Save_Click(...)
{
if (Save.Text == "Save") {
if (CheckIfProductExists())
Save.Text = "Overwrite";
Status.Text = "This product is already exist. Click Overwrite to update."
return;
}
Status.Text ="";
SaveProduct();
}
 
P

pardesiya

Thanks a lot Alexy and KJ.
Both the suggestions give me something different to try out.
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top