473,795 Members | 2,605 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Conditional confirmation dialog

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

May 18 '07 #1
3 2663

"pardesiya" <ze******@gmail .comwrote in message
news:11******** **************@ u30g2000hsc.goo glegroups.com.. .
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 (CheckIfProduct Exists())
Save.Text = "Overwrite" ;
Status.Text = "This product is already exist. Click Overwrite to update."
return;
}
Status.Text ="";
SaveProduct();
}
May 18 '07 #2
KJ
My suggestion may be a little over-complicated, but you might find it cool
also: Wrap your product-finding method in a web service call, then use
ASP.NET AJAX extensions to call that web service from the client-side. Check
out the articles:

http://ajax.asp.net/docs/tutorials/C...XTutorial.aspx

http://ajax.asp.net/docs/tutorials/E...XTutorial.aspx
"Alexey Smirnov" <al************ @gmail.comwrote in message
news:O8******** ******@TK2MSFTN GP06.phx.gbl...
>
"pardesiya" <ze******@gmail .comwrote in message
news:11******** **************@ u30g2000hsc.goo glegroups.com.. .
>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 (CheckIfProduct Exists())
Save.Text = "Overwrite" ;
Status.Text = "This product is already exist. Click Overwrite to update."
return;
}
Status.Text ="";
SaveProduct();
}


May 18 '07 #3
Thanks a lot Alexy and KJ.
Both the suggestions give me something different to try out.
May 21 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1636
by: RyanG | last post by:
Say I have an app that, using the server & database, verifies some information the user has submitted (EX: verifying to make sure the address matches our record). What I want to be able to do is IF the information matches what's in the database, when he hits the submit button he will be redirected to the next page. If the information does NOT match, I want a JavaScript confirmation box to appear informing the user that some information...
6
1670
by: Dotnet Guy | last post by:
I want to add a confirmation dialog box before I delete the records in my form. I have a piece of javascript code in html that checks for confirmation. But the main issue lies in calling this javascript function on pagebehind. function confirm_delete() { if (confirm("Are you sure you want
1
13466
by: Amelyan | last post by:
What is the common way in ASP.NET C# to pop up a confirmation dialog box? E.g. Are you sure you want to delete this item? Yes No
1
1939
by: Joey | last post by:
I am using a datagrid with a SELECT button to determine which record to delete. The code behind pulls the selected item's record number (via a hidden column) in the grid with SelectedItem.Cells.Text, and then uses a stored procedure to delete the record. I need to wire up a javascript confirmation dialog (Are you sure you want to delete this record? Yes/No) to it. Any suggestions on how to do this?
3
1760
by: John | last post by:
Hi I have an app to deal with two companies A & B within a group of companies depending on which database is selected. Is it possible for setup to ask the user at install time which company they want to install the app for and then pass the relevant database path as parameter in the desktop shortcut? Thanks Regards
2
8996
by: steggun | last post by:
How To: Popup Confirmation Dialog & Redirect in LinkButton_OnClick Hello All, I have a ASP.NET 2.0 (C#) web form with a LinkButton control. In the server-side code for the LinkButton_OnClick event, I need to do some processing and, if it succeeds, popup a confirmation dialog and redirect to a different page. How can I do this? Here's some pseudo-code:
1
1325
by: Amit | last post by:
How do I display a confirmation dialog when the user tries to delete a row? When the user selects a row in the DataGridView and hits the delete key Thanks, Amit
0
956
by: Amil Hanish | last post by:
In VS 2003, when I would delete all breakpoints or bookmarks, there was no confirmation and it was quick and easy via shortcut keys. In VS 2005, it always pops up a confirmation dialog when I do this. Is there a way to disable this prompting? Amil
5
9300
by: Tomislav | last post by:
Hello, I tried to use "javascript:return confirm();" function in following manner ( triggered by form onSubmit event ): ** <form method="post" action="mail.php" onSubmit="javascript:return confirm('Do you really want to send this order ?);">
0
10436
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10213
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10163
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9040
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3722
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.