Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Message box in asp.net

Reply
Thread Tools

Message box in asp.net

 
 
ratnakarp@gmail.com
Guest
Posts: n/a
 
      03-10-2006
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

 
Reply With Quote
 
 
 
 
=?Utf-8?B?RWx0b24gVw==?=
Guest
Posts: n/a
 
      03-10-2006
btn.Attributes.Add("onClick", "return confirm('Do you really want to delete
the record?');");

HTH

Elton Wang

"(E-Mail Removed)" 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
>
>

 
Reply With Quote
 
 
 
 
ratnakarp@gmail.com
Guest
Posts: n/a
 
      03-10-2006
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.

 
Reply With Quote
 
=?Utf-8?B?RWx0b24gVw==?=
Guest
Posts: n/a
 
      03-10-2006
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


"(E-Mail Removed)" 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.
>
>

 
Reply With Quote
 
blackstaronline.net
Guest
Posts: n/a
 
      03-10-2006
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

 
Reply With Quote
 
ratnakarp@gmail.com
Guest
Posts: n/a
 
      03-13-2006
Do you guyz got any other ideaz, looks like these things are not
working for me? Thanks for your help

Regards,
Ratnakar Pedagani

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
div box questions; float text around a box, fit box to image size Gnarlodious HTML 4 05-05-2010 11:30 AM
how to selecet check box in the data grid ?? only one check box mit ASP .Net 1 01-25-2006 06:47 PM
populate one list box with selected values from another list box steven.cooper@infocision.com ASP .Net 1 03-12-2005 11:29 PM
New to .NET, can I have one drop down box control the data of another drop down box using a database? SirPoonga ASP .Net 2 01-07-2005 10:44 PM
COMBO BOX INSTEAD OF DROP DOWN BOX =?Utf-8?B?QW5nZWw=?= ASP .Net 3 06-29-2004 06:38 PM



Advertisments