Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

confirmation box

Status
Not open for further replies.

dazza12345

Programmer
Nov 25, 2005
35
GB
Hi all,
I have a button that will delete a row from a database. However, I dont really want to alow the user to delete database entries without confirmation.

What would be the best way of asking the user for conformation? A popup box?

if so, has any1 got any example code that will popup a box that will allow the user to select yes or no.

Cheers
 
You could use some javascript.
I would prefer to redirect to a new page (carrying the nesecary info.. by querystring or session etc) and have there 2 links. One for no and one for yes. Then redirect back. It is the way that tektips use when you want to delete a forum from your threadminder.

Hope this helps !
 
Im not using a datagrid and would prefer not to redirect to another page. Is there any way of just getting a confirmation box to pop up to appear from the same page?
 
Just add the javascript function to the button's attributes on the page_load (I think you'll need to add "return false" so that the button won't post back.
 
as jshurst said set the attribute for your button..

e.g.

YourButton.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');")



 
Did you actually read the article suggested to you in the second reply? If you had, you would notice that there is an example of how to add the client-side confirmation...


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top