Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics 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 July 2nd, 2009, 10:58 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
Question Confirm Message Box

I have an app where I use Confirm Message Box pop up. The application checks if a report (crystal) alredy exists as a .pdf, if so I show a confirm pop up and if click is OK the I plan to replace existing .pdf (ie save to a folder)

I have following code snippet. The issue is when confirm pop up is displayed, I have to click the OK twice before it enters into the "btnConfirm" sub

Step 1 - Check report exists

Code:
 
Response = CheckDocumentExists(FilePath, DocumentName)
 
If Response(1) = "Yes" Then
MsgBox_Confirm(Response(0))
Step 2 - Report exists, call confirm pop up

Code:
 
Public Overloads Sub ASPNET_MsgBox_Confirm(ByVal Message As String) 'Confirm
Page.ClientScript.RegisterStartupScript(Me.GetType(), "Confirmation", "Confirmation();", True)
End Sub
Step 3 - Handle Response to pop up

Code:
 
<scripttype="text/javascript"language="javascript">
function Confirmation()
{
if(confirm("Daily Sales Report already exists. Do you want to replace it ?")== true)
{
//Calling the server side code after confirmation from the user
document.getElementById('<%=btnConfirm.ClientID%>').click();
}
}
</script>
<asp:ButtonID="btnConfirm"OnClientClick="return Confirmation();"runat="server"style="display: none"Text="Confirm"OnClick="btnConfirm_Click"/>
Step 4 - Action when OK clicked

Code:
 
Protected Sub btnConfirm_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim Response As String
Response = "Debug, I reached this point ..."
End Sub
 
Old July 2nd, 2009, 03:33 PM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 207
Thanks: 2
Thanked 15 Times in 15 Posts
Default This might be unrelated...

This might be unrelated but i would change your variable name from Response to Resp or something else. Response is already denoted as an object. Could be causing a conflict?
__________________
Jason Hall

Follow me on Twitter @jhall2013
 
Old July 2nd, 2009, 05:02 PM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Jason, I will try to do that but I think my problem is related to the postback somehow. As I said I have to click the OK button twice before it fires the event on the server.





Similar Threads
Thread Thread Starter Forum Replies Last Post
JavaScript Confirm Box ricespn Classic ASP Basics 1 January 20th, 2007 12:48 AM
Javascript Confirm Message box itHighway Javascript How-To 5 September 25th, 2006 02:51 AM
R (registered) symbol in a confirm box crmpicco Javascript 9 December 5th, 2005 09:07 AM
prob.. confirm message abhit_kumar JSP Basics 0 December 29th, 2004 06:37 AM
Confirm alert box - need help, Please! larry HTML Code Clinic 1 January 25th, 2004 02:07 AM





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