473,386 Members | 1,819 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,386 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 2526
"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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.