.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old June 30th, 2009, 03:44 PM
snufse snufse is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2009
Posts: 7 snufse User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 10 m 33 sec
Reputation Power: 0
Question JScript - General - Question - Confirm - pop up box

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?

Reply With Quote
  #2  
Old June 30th, 2009, 06:26 PM
banksie banksie is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2007
Location: Crowle, Worcester
Posts: 21 banksie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 1 m 23 sec
Reputation Power: 0
Quote:
Originally Posted by snufse
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?



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!

Reply With Quote
  #3  
Old June 30th, 2009, 06:31 PM
banksie banksie is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2007
Location: Crowle, Worcester
Posts: 21 banksie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 1 m 23 sec
Reputation Power: 0
Quote:
Originally Posted by banksie
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!


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

Reply With Quote
  #4  
Old July 1st, 2009, 02:04 PM
snufse snufse is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2009
Posts: 7 snufse User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 10 m 33 sec
Reputation Power: 0
Question

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

Reply With Quote
  #5  
Old July 1st, 2009, 04:04 PM
banksie banksie is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2007
Location: Crowle, Worcester
Posts: 21 banksie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 1 m 23 sec
Reputation Power: 0
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!

Reply With Quote
  #6  
Old July 5th, 2009, 11:25 PM
alexson115 alexson115 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2009
Posts: 2 alexson115 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 31 sec
Reputation Power: 0
Thank you, this is good news for other visitors

Reply With Quote
  #7  
Old July 5th, 2009, 11:26 PM
alexson115 alexson115 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2009
Posts: 2 alexson115 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 31 sec
Reputation Power: 0
Thank you, this is good news for other visitors

Reply With Quote
Reply

Viewing: ASP Free ForumsProgramming.NET Development > JScript - General - Question - Confirm - pop up box


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
Stay green...Green IT