By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,903 Members | 1,593 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,903 IT Pros & Developers. It's quick & easy.

problem when using Confirmation box in ASP.NET program

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.