473,498 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Message box in asp.net

hi,

i want to pop up a message box when a button is clicked. the situation
is something like this as follows.
protected void button1_click(.. , ..)
{
.......
........
.......

response.write(<script language="javascript"> or
language="vbscript">confirm or msgbox or etc..</script>)
if(clicked yes)
{
do the following

}
else
get out of the method

}
is there any way if user clicks yes on the confirm box or message box,
the rest of the code in button1 click method should be executed
otherwise get out of the method. Any help or reference is appreciated.

Thanks,
Ratnakar Pedagani

Mar 10 '06 #1
5 1213
btn.Attributes.Add("onClick", "return confirm('Do you really want to delete
the record?');");

HTH

Elton Wang

"ra*******@gmail.com" wrote:
hi,

i want to pop up a message box when a button is clicked. the situation
is something like this as follows.
protected void button1_click(.. , ..)
{
.......
........
.......

response.write(<script language="javascript"> or
language="vbscript">confirm or msgbox or etc..</script>)
if(clicked yes)
{
do the following

}
else
get out of the method

}
is there any way if user clicks yes on the confirm box or message box,
the rest of the code in button1 click method should be executed
otherwise get out of the method. Any help or reference is appreciated.

Thanks,
Ratnakar Pedagani

Mar 10 '06 #2
Hello Elton,

Thanks for your reply, but here i'm facing the problem., i forgot to
add a condition. i changed the code. In the following code, if the
cond1 is true, then the confirm message should pop up. if clicked yes,
i should be able to do something else within button click method. for
example

protected void button1_click(.. , ..)
{
x=callmethod1();
y=callmethod2();
z=str1;

if(z>40)
{
//pop up confirm box, "do you want to continue"
response.write(<script language="javascript"> or
language="vbscript">confirm or msgbox or etc..</script>)
if(clicked yes)
{
save the details in the database;
}
else
{
get out of the method
}
}

can you please let me know how to proceed further. Kindly let me know
if you need to know anything else.

Thanks & Regards,
Ratnakar Pedagani.

Mar 10 '06 #3
You should know that client-server (Web) application is different from
desktop one. Especially, in server-side code you can’t directly interact with
user. What I can suggest is to put your logic on client-side (javascript
function(s)). Only when postback, on server-side to save detail to DB:

Server Code:
Page_Load(){
// ...
btn.Attributes.Add("onClick", "return CheckZ();");
}

btn_Click(...)
{
// save info;
}

Client code:

<script>
function CheckZ()
{
var z = getZ;
if(z <=40)
{
return false;
}
Return confirm(confirm message);
}
</script>
HTH
"ra*******@gmail.com" wrote:
Hello Elton,

Thanks for your reply, but here i'm facing the problem., i forgot to
add a condition. i changed the code. In the following code, if the
cond1 is true, then the confirm message should pop up. if clicked yes,
i should be able to do something else within button click method. for
example

protected void button1_click(.. , ..)
{
x=callmethod1();
y=callmethod2();
z=str1;

if(z>40)
{
//pop up confirm box, "do you want to continue"
response.write(<script language="javascript"> or
language="vbscript">confirm or msgbox or etc..</script>)
if(clicked yes)
{
save the details in the database;
}
else
{
get out of the method
}
}

can you please let me know how to proceed further. Kindly let me know
if you need to know anything else.

Thanks & Regards,
Ratnakar Pedagani.

Mar 10 '06 #4
Here is an article on this topic.

http://hgtit.com/dotnet/aspdotnet_de...firmation.aspx

Although this uses "delete" as an example the code will be the same for
whatever you want to do. The examples are setup so that on click the
box pops up, if 'OK' run a separate Sub, if 'Cancel' it does nothing.

Hope it helps,
Jeremy Reid
http://hgtit.com

Mar 10 '06 #5
Do you guyz got any other ideaz, looks like these things are not
working for me? Thanks for your help

Regards,
Ratnakar Pedagani

Mar 13 '06 #6

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

Similar topics

3
6982
by: Hugh Welford | last post by:
Hi Using WIN XP and FP2000 Using CDO.message to out put a message from my site, I get the following error message 8004020f from using the code:- strsql = "SELECT * FROM details WHERE patid...
8
16313
by: Brian Keating EI9FXB | last post by:
Would I be correct in saying that the only way to get a user message into a Windows form would be to use P/Invoke with Message? Of is there some part of the .NET API that I am totally un aware...
8
9986
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported...
2
3274
by: Microsoft News | last post by:
What I have is a message box that pops up. It is another browser window. The code is a general function that you pass message, title and a key to. The box works great except, that if you are on a...
0
1955
by: ronscottlangham | last post by:
I am working on a custom WCF EndpoingBehavior that will modify the messages coming in and out of my Service. I am having an error related to the modification of the message in the...
2
12137
by: =?Utf-8?B?QWRl?= | last post by:
HI All, I am encountering the following error when I try to send an email through a SMTP server. I believe the problem lies with the authentication part when the network crednetials are used,...
3
3815
by: Steven Allport | last post by:
I am working on processing eml email message using the email module (python 2.5), on files exported from an Outlook PST file, to extract the composite parts of the email. In most instances this...
0
2677
by: Philluminati | last post by:
I have a Perl SOAP Server which returns this SOAP Message when invoked: <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http:// www.w3.org/2001/XMLSchema-instance"...
2
6458
by: bernd | last post by:
Hi netties, posted this in a different group already, which seems to be inappropriate. I create a message queue with msgget(), sent a 5-byte message to it with msgsnd() and try to receive the...
2
2615
by: forums_mp | last post by:
Facing a design problem here and I'm not sure how to solve this. The system consists of bi-directional communication between a subject communicating with two (at least for now ) listeners. ...
0
7125
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
7205
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7379
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
5462
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,...
1
4910
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4590
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3093
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3085
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.