473,324 Members | 2,511 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,324 software developers and data experts.

MessageBox

mac

Hi!

I've created a simple ASPX form that displays a record from a SQL Server
table. I have a "Delete" button on the form. When the user clicks it,
I want to prompt the user with
a message ("Are you sure you want to delete... ?").

I realize the Yes/No Messagebox can be done via Javascript -- but how do
I retrieve the Messagebox return value in my .ASPX page?
so I can act on it (i.e., to perform the delete)?
Thanks in Advance
Mac
Jun 22 '06 #1
4 2524
"mac" <ma************@hotmail.com> wrote in message
news:eP**************@TK2MSFTNGP04.phx.gbl...
I realize the Yes/No Messagebox can be done via Javascript -- but how do
I retrieve the Messagebox return value in my .ASPX page?
so I can act on it (i.e., to perform the delete)?


return confirm('Are you sure you want to delete this record?');
Jun 22 '06 #2
Hi Mac,

You can add the confirmation messagebox in aspx page as shown below.
You have to wirte the following code on the page load event , which adds an
onclick event to the asp.net button to
display a message box. When u click ok it will proceed to the delete
operation.
protected void Page_Load(object sender, EventArgs e)

{

bnDelete.Attributes.Add("onclick",

"return(confirm('Are you sure to delete?'));");

}

Regards,

Valli

(www.syncfusion.com)

ASP.Net FAQ:
http://www.syncfusion.com/faq/aspnet/default.aspx

Complete set of ASP.Net controls and components
http://www.syncfusion.com/toolsweb
"mac" <ma************@hotmail.com> wrote in message
news:eP**************@TK2MSFTNGP04.phx.gbl...

Hi!

I've created a simple ASPX form that displays a record from a SQL Server
table. I have a "Delete" button on the form. When the user clicks it,
I want to prompt the user with
a message ("Are you sure you want to delete... ?").

I realize the Yes/No Messagebox can be done via Javascript -- but how do
I retrieve the Messagebox return value in my .ASPX page?
so I can act on it (i.e., to perform the delete)?
Thanks in Advance
Mac

Jun 22 '06 #3
Well, thats a bit vague. If the user clicks no/cancel, the form isn't
POSTed to the server so nothing changes. If the users clicks yes/ok,
then the form is POSTed back.

You can then assume that if the form is POSTed then the user clicked the
yes/ok button. If the user has javascript disabled, obviously you
cannot determine this.

Regards
Ray

ValliM wrote:
Hi Mac,

You can add the confirmation messagebox in aspx page as shown below.
You have to wirte the following code on the page load event , which adds an
onclick event to the asp.net button to
display a message box. When u click ok it will proceed to the delete
operation.
protected void Page_Load(object sender, EventArgs e)

{

bnDelete.Attributes.Add("onclick",

"return(confirm('Are you sure to delete?'));");

}

Regards,

Valli

(www.syncfusion.com)

ASP.Net FAQ:
http://www.syncfusion.com/faq/aspnet/default.aspx

Complete set of ASP.Net controls and components
http://www.syncfusion.com/toolsweb
"mac" <ma************@hotmail.com> wrote in message
news:eP**************@TK2MSFTNGP04.phx.gbl...
Hi!

I've created a simple ASPX form that displays a record from a SQL Server
table. I have a "Delete" button on the form. When the user clicks it,
I want to prompt the user with
a message ("Are you sure you want to delete... ?").

I realize the Yes/No Messagebox can be done via Javascript -- but how do
I retrieve the Messagebox return value in my .ASPX page?
so I can act on it (i.e., to perform the delete)?
Thanks in Advance
Mac


Jun 22 '06 #4
Here's some server side code that uses javascript to display a confirmation
message.

myDeleteButton.Attributes.Add("onclick", _
"return confirm('Are you sure you want to delete?');")

In this example, the Delete button will post back only if the person
confirms they want to delete. Otherwise the server code is never called in
response to the button click.

Here's more info:
http://SteveOrr.net/articles/ClientSideSuite.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"mac" <ma************@hotmail.com> wrote in message
news:eP**************@TK2MSFTNGP04.phx.gbl...

Hi!

I've created a simple ASPX form that displays a record from a SQL Server
table. I have a "Delete" button on the form. When the user clicks it,
I want to prompt the user with
a message ("Are you sure you want to delete... ?").

I realize the Yes/No Messagebox can be done via Javascript -- but how do
I retrieve the Messagebox return value in my .ASPX page?
so I can act on it (i.e., to perform the delete)?
Thanks in Advance
Mac

Jun 22 '06 #5

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

Similar topics

11
by: Rich Tasker | last post by:
I have a strange situation. A simple call to MessageBox.Show("XXX", "YYY") does not display the message in the messagebox with a visible font. Based on the content of the messagebox, the box...
8
by: Dennis C. Drumm | last post by:
I have ordered the book .NET Framework Solutions, In Search of the Lost Win32 API by John Paul Meuller which I think will help answer some of my questions I have regarding making custom...
2
by: Dennis C. Drumm | last post by:
This is a restatement of an earlier post that evidently wasn't clear. I am building a custom MessageBox dialog that has, among other things, a few new button options (yes to all, no to all, etc.)...
8
by: Saso Zagoranski | last post by:
Hi! I'm trying to make my own MessageBox... What I would like to know is, how the MessageBox class is implemented? I could have something like: new MyMessageBox().ShowDialog(); but I would...
4
by: Tressa | last post by:
I have a messagebox that I only want to pop up only if it is not already being displayed on the screen. My code is still poping up the messagebox even though it is on the screen. What am I doing...
3
by: Sin | last post by:
I'm currently evaluating VC.NET as the new platform for the company I work for and things are looking grim... We're up against another IDE which took me about 5 minutes to master and I've been...
0
by: alex_f_il | last post by:
The class centers MessageBox inside the parent rectangle. Enjoy! using System; using System.Windows.Forms; using System.Text; using System.Drawing; using System.Runtime.InteropServices; ...
20
by: Peter E. Granger | last post by:
I'm having a strange problem (or at least it seems strange to me) trying to display a MessageBox in a VC++ .NET forms application. If I put the call to MessageBox::Show in the form's .h file, it...
10
by: Russ | last post by:
I've been trying to figure out how to show a simple messagebox with an OK button in my web client program (C#). I have looked at every reference to JScript and MessageBox that seemed even remotely...
4
by: Larry Woods | last post by:
I have a Messagebox that looks like: MessageBox.Show("There are pending changes for this patient. Do you want to continue to close?", "Pending Changes", MessageBoxButtons.YesNo,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.