|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have an application where I am trying to get my "confirm" message box to work. The scenario is: User brings up a page showing a crystal report and click the button to save the report to file. If report already exists I need to show a message box to confirm that user wants to replace:
Code:
Public Overloads Sub MsgBox_Confirm(ByVal Message As String) 'Confirm
Page.ClientScript.RegisterStartupScript(Me.GetType (), "Confirmation", "Confirmation();", True)
End Sub
Code:
Protected Sub btnConfirm_Click(ByVal sender As Object, ByVal e As System.EventArgs) ...action code goes here .... End Sub Code:
<script type="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").click();
}
}
</script>
The message box is being shown, however, when I click OK, then the program does not execute the btnConfirm. Can someone tell what I am doing wrong? |
|
#2
|
|||
|
|||
|
Quote:
Sorry i don't get if the program gives a alert box (one with only one option which is the ok button) or an option of 2 buttons a ok and a cancel? It might be me being stupid! |
|
#3
|
|||
|
|||
|
Quote:
This site might help http://w3schools.com/js/js_popup.asp I use w3schools alot, and its helped me work out problems and teach me stuff! Im pritty new to Javascript so this is all the help i can give! Sorry |
|
#4
|
|||
|
|||
|
Yes, I have very little expereinece with js as well including how to fire server side event based upon a cklient click event.
Here is the code I'm working on right now but I cannot get the btnConfirm_Click to fire: Code:
<script type="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
__doPostBack('btnConfirm','');
}
}
</script>
<asp:Button ID="btnConfirm" OnClientClick="return Confirmation();" runat="server" style="display: none" Text="Confirm" OnClick="btnConfirm_Click" />
Code:
Protected Sub btnConfirm_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim Response As String
Response = "Response is OK"
End Sub
|
|
#5
|
|||
|
|||
|
your not declaring the name of the confirm box
you need to have something like this Code:
var r=confirm("Daily Sales Report already exists. Do you want to replace it ?");
then you do the check like this Code:
if (r==true)
{
//just call a procedure
}
else
{
//call a different procedure
}
i hope this helps and this is really limiting my knowleadge! |
|
#6
|
|||
|
|||
|
Thank you, this is good news for other visitors
![]() |
|
#7
|
|||
|
|||
|
Thank you, this is good news for other visitors
![]() |
![]() |
| Viewing: ASP Free Forums > Programming > .NET Development > JScript - General - Question - Confirm - pop up box |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|