Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > .NET Framework 1.x
|
.NET Framework 1.x For discussing versions 1.0 and 1.1 of the Microsoft .NET Framework.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 1.x section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 30th, 2006, 05:49 PM
Authorized User
 
Join Date: Jun 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default avoid getting save confirmation on button click

I have a search button on my web page, which is supposed to save the contents of the page into the database before it does the search.
Before i save the contents i get a confirmation from the user -- for which i'm using the following code -

btnSearch.Attributes.Add("onClick", "javascript:return confirm('Are you sure you want to save')") ;
my problem is that, i do not want the above confirmation message to appear, when the user clicks the Search button
for the first time, as there's nothing to save at that moment, and rather execute the search code.
Please advise.


 
Old February 1st, 2006, 12:52 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

only add your code if the page is a post back.
if IsPostBack then
   btnSearch.Attributes.Add("onClick", "javascript:return confirm('Are you sure you want to save')") ;
end if

JIm






Similar Threads
Thread Thread Starter Forum Replies Last Post
confirmation from user from a delete button in the sansircar ASP.NET 1.0 and 1.1 Professional 1 January 25th, 2006 01:44 PM
How Avoid Dialog Box Open/Save Files see07 ASP.NET 1.x and 2.0 Application Design 4 February 23rd, 2005 07:36 PM
How to disable Right-click to Save Picture As.... bekim HTML Code Clinic 11 January 9th, 2005 02:09 AM
Disable Right-click for Save Image As... bekim Javascript How-To 5 January 7th, 2005 09:03 PM
Save the Confirmation Page as a file kelcontech Classic ASP Basics 8 May 13th, 2004 08:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.