Conditional confirmation dialog

  • Thread starter Thread starter pardesiya
  • Start date Start date
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
 
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();
}
 
Thanks a lot Alexy and KJ.
Both the suggestions give me something different to try out.
 
Back
Top