Warning Messages...

I

Irfan Akram

Hi Guys,

I was wondering if you can help me with this question. I am trying to
display warning messages on my web-page, prompting the user to check his
action, and confirm what the current action would do. What is the best way of
doing that in asp.net. I know that we can do that easily in windows
programming, but I am not too sure in Web Programming. Will wait for a
response, and will value your responses.

Thanks,

Irfan
 
J

John Saunders

Irfan Akram said:
Hi Guys,

I was wondering if you can help me with this question. I am trying to
display warning messages on my web-page, prompting the user to check his
action, and confirm what the current action would do. What is the best way
of
doing that in asp.net. I know that we can do that easily in windows
programming, but I am not too sure in Web Programming. Will wait for a
response, and will value your responses.

You can use the confirm function in client-side JavaScript, as follows:

string confirm =
string.Format(
@"return confirm('Are you sure you want to delete {0}?');",
name);
lnkDelete.Attributes["onclick"] = confirm;

When the button is clicked, a dialog box will be displayed. If the user
clicks Ok, then the onclick event will continue (and in this case will do
the normal postback). If the user clicks Cancel, then the onclick event will
be cancelled, and it will be as though the button had not been clicked. This
is because the confirm function returns true if Ok is clicked, false it
Cancel is clicked.

John Saunders
 
M

Mike MacMillan

also, if you require more functionality than Confirm, you can popup a window
that warns the user, which contains controls to handle their action.

Mike



John Saunders said:
Irfan Akram said:
Hi Guys,

I was wondering if you can help me with this question. I am trying to
display warning messages on my web-page, prompting the user to check his
action, and confirm what the current action would do. What is the best way
of
doing that in asp.net. I know that we can do that easily in windows
programming, but I am not too sure in Web Programming. Will wait for a
response, and will value your responses.

You can use the confirm function in client-side JavaScript, as follows:

string confirm =
string.Format(
@"return confirm('Are you sure you want to delete {0}?');",
name);
lnkDelete.Attributes["onclick"] = confirm;

When the button is clicked, a dialog box will be displayed. If the user
clicks Ok, then the onclick event will continue (and in this case will do
the normal postback). If the user clicks Cancel, then the onclick event will
be cancelled, and it will be as though the button had not been clicked. This
is because the confirm function returns true if Ok is clicked, false it
Cancel is clicked.

John Saunders
 
J

Jose Rojas

How can this get done by using direct ASP.NET not JS?

Sorry I know this is not my question....
Jose Rojas
Mike MacMillan said:
also, if you require more functionality than Confirm, you can popup a
window
that warns the user, which contains controls to handle their action.

Mike



John Saunders said:
Irfan Akram said:
Hi Guys,

I was wondering if you can help me with this question. I am trying to
display warning messages on my web-page, prompting the user to check
his
action, and confirm what the current action would do. What is the best way
of
doing that in asp.net. I know that we can do that easily in windows
programming, but I am not too sure in Web Programming. Will wait for a
response, and will value your responses.

You can use the confirm function in client-side JavaScript, as follows:

string confirm =
string.Format(
@"return confirm('Are you sure you want to delete {0}?');",
name);
lnkDelete.Attributes["onclick"] = confirm;

When the button is clicked, a dialog box will be displayed. If the user
clicks Ok, then the onclick event will continue (and in this case will do
the normal postback). If the user clicks Cancel, then the onclick event will
be cancelled, and it will be as though the button had not been clicked. This
is because the confirm function returns true if Ok is clicked, false it
Cancel is clicked.

John Saunders
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top