|
|
 |
| 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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

July 2nd, 2009, 11:58 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2007
Location: West Palm Beach, Florida, USA.
Posts: 198
Thanks: 4
Thanked 0 Times in 0 Posts
|
|
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
|

July 2nd, 2009, 04:33 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2007
Location: Central Florida, USA.
Posts: 199
Thanks: 2
Thanked 15 Times in 15 Posts
|
|
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
|

July 2nd, 2009, 06:02 PM
|
|
Friend of Wrox
|
|
Join Date: Mar 2007
Location: West Palm Beach, Florida, USA.
Posts: 198
Thanks: 4
Thanked 0 Times in 0 Posts
|
|
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.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |