473,396 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

problem when using Confirmation box in ASP.NET program

Hi all,

I still have a problem when using Confirmation box in ASP.NET program. I
need to get the value return of YES or NO from confirmation box in Sub
function of VB program to do some tasks. For example, I have 2 text boxes
and one button. The button will call On_Click event .

Sub btnSelect_OnClick(ByVal sender As Object, ByVal e As EventArgs)
Dim X as double = CDBL(txtbox1.text)
Dim Y as double = CDBL(txtbox2.text)

If X > Y Then
display confirmation box ("Add $50 to X ? ")
If answer = YES Then X=X+50
Else Do Nothing
End If
Else
display confirmation box ("Subtract $50 to X ? ")
If answer = YES Then X=X-50
Else Do Nothing
End If
End If
End Sub

Can we get the return value of YES / NO from confirmation box with this
pseudocode ? As I know the confirmation will work when you have an event
before clicking the button (e.g in Page_Load
Me.Button1.Attributes.Add("OnClick","return confirm('Are you sure you add
$50 to the X ?');") ) . With this the message is not dynamic.

Can you provide a source code for this ?

Thanks in advance.
Jun 16 '06 #1
2 2005
no. you have to render the page, with the client script confirm code that
reposts it the user confirms. you might as well redesign and
redirect/transfer to a confirmation page.

-- bruce (sqlwork.com)
"bienwell" <bi******@hotmail.com> wrote in message
news:uR**************@TK2MSFTNGP03.phx.gbl...
Hi all,

I still have a problem when using Confirmation box in ASP.NET program. I
need to get the value return of YES or NO from confirmation box in Sub
function of VB program to do some tasks. For example, I have 2 text boxes
and one button. The button will call On_Click event .

Sub btnSelect_OnClick(ByVal sender As Object, ByVal e As EventArgs)
Dim X as double = CDBL(txtbox1.text)
Dim Y as double = CDBL(txtbox2.text)

If X > Y Then
display confirmation box ("Add $50 to X ? ")
If answer = YES Then X=X+50
Else Do Nothing
End If
Else
display confirmation box ("Subtract $50 to X ? ")
If answer = YES Then X=X-50
Else Do Nothing
End If
End If
End Sub

Can we get the return value of YES / NO from confirmation box with this
pseudocode ? As I know the confirmation will work when you have an event
before clicking the button (e.g in Page_Load
Me.Button1.Attributes.Add("OnClick","return confirm('Are you sure you add
$50 to the X ?');") ) . With this the message is not dynamic.

Can you provide a source code for this ?

Thanks in advance.

Jun 16 '06 #2
V
Hello,

One really good way that I have always worked with client-side
javascript is to emit it from the control.

Derive the Asp.Net server side button and override the appropriate
methods to insert a Javascript that produces the Confirm Dialogue Box.
This Javascript should contain the code for causing a PostBack from the
button if the user clicks yes, and to do nothing if the user clicks no.

This can be made even more useful, if you add properties in the derived
control that let you specify whether you want to show a confirmation
dialogue box at all, and if yes, then what should the text contain.

This allows for the creation of a re-usable server side control which
can be used as a normal button when needed.

Regards,
Vaibhav

bienwell wrote:
Hi all,

I still have a problem when using Confirmation box in ASP.NET program. I
need to get the value return of YES or NO from confirmation box in Sub
function of VB program to do some tasks. For example, I have 2 text boxes
and one button. The button will call On_Click event .

Sub btnSelect_OnClick(ByVal sender As Object, ByVal e As EventArgs)
Dim X as double = CDBL(txtbox1.text)
Dim Y as double = CDBL(txtbox2.text)

If X > Y Then
display confirmation box ("Add $50 to X ? ")
If answer = YES Then X=X+50
Else Do Nothing
End If
Else
display confirmation box ("Subtract $50 to X ? ")
If answer = YES Then X=X-50
Else Do Nothing
End If
End If
End Sub

Can we get the return value of YES / NO from confirmation box with this
pseudocode ? As I know the confirmation will work when you have an event
before clicking the button (e.g in Page_Load
Me.Button1.Attributes.Add("OnClick","return confirm('Are you sure you add
$50 to the X ?');") ) . With this the message is not dynamic.

Can you provide a source code for this ?

Thanks in advance.


Jun 16 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Matthew | last post by:
I am have written a medium sized program and everything works fine except for one piece. At a certain point in the program I want to do a simple user confirmation, eg Are you sure ? y/n. The...
2
by: Calvin | last post by:
Hi, Envronment: IIS 5 on W2k sp3 Problem: I'm using a Form and when Submitted, will display a confirmation page. The confirmation page is simply a Form with an OK button. I want the browser...
2
by: pmud | last post by:
Hi, In my ASP.NET application, the user has to enter a large amount of data so that with submit button click all this information can go to SQL database.Wen the user clicks submit, he is...
5
by: IkBenHet | last post by:
Hello, I use this script to upload image files to a folder on a IIS6 server: ******************* START UPLOAD.ASPX FILE ********************** <%@ Page Language="VB" Debug="true" %>
0
by: Suzanne | last post by:
I'd like to know how can I put up a confirmation question when the user tries to delete a row in the datagrid by clicking on the row header and pressing the Delete key? I have found this code on...
1
by: almarc | last post by:
Problem : Stop an "Unonlaod" when then confirmation is false. Is a really good script but i have just one problem. The problem that i have is when i click on a link. The scipt ask "Do you want to...
5
by: jmartmem | last post by:
Greetings, I have built an Update Record Form in an ASP page. This form contains a number of fields, such as text boxes and menus, to name a few. Upon clicking the 'submit' button, I want the...
3
by: swethak | last post by:
hi, i run the below code i got the below error when i run in my local system.And i placed same program in website it works fine.plz tell that what's the mistake in that. <?php $to...
28
tdw
by: tdw | last post by:
Hi all, I am trying to add a feature to our database that automates sending emails. When entering a new order, I want the option to send an email to the company the order came from, attaching a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.