Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 21st, 2005, 07:36 AM
Friend of Wrox
Points: 464, Level: 7
Points: 464, Level: 7 Points: 464, Level: 7 Points: 464, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2005
Location: Colombo, , Sri Lanka.
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nalla Send a message via Yahoo to nalla
Default message box


Hi,

I have added an attribute to a button in page load as,

this.btnHome.Attributes.Add("onclick","if(!confirm ('Are you sure to delete this Event?')) return false;");

and this shows the message box properly with 2 options "Ok" and "Cancel". so i added a condition inside the button's click event as,

if(!confirm('Are you sure to delete this Event?'))
   {

   }
else
   {

   }
but this shows 2 syntax errors as,
(1) The name confirn doesnot exist in the class or namespace ....
(2) Too many characters in the character literal.

how can i return whether user pressed "Ok" or "Cancel"??

nalla


__________________
nalaka hewage
http://nalakahewage.blogspot.com
 
Old December 22nd, 2005, 03:11 AM
Registered User
 
Join Date: Dec 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sky_handsome
Default

hi, i have tried to put the if-else statement in a javascript function, then associate this function with OnClick event, then that code works correctly!!

 
Old December 22nd, 2005, 04:35 AM
Friend of Wrox
Points: 464, Level: 7
Points: 464, Level: 7 Points: 464, Level: 7 Points: 464, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2005
Location: Colombo, , Sri Lanka.
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nalla Send a message via Yahoo to nalla
Default



Hi,

I need to do it in my C# code. but anyway it's fine if it's working in java code. can explain bit more how did you do it and post the code?

nalla


 
Old December 22nd, 2005, 09:23 PM
Registered User
 
Join Date: Dec 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sky_handsome
Default

<script type="text/javascript">
function doConfirm()
{
    if(!Confirm('ffds'))
    {}
     else
     {}
}
</script>

i put the above code in the aspx file. then i write the following code in c#.
this.Button1.Attributes.Add("OnClick","doConfirm() ");

you can try this. it works well on my machine.

 
Old December 23rd, 2005, 03:00 AM
Friend of Wrox
Points: 464, Level: 7
Points: 464, Level: 7 Points: 464, Level: 7 Points: 464, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2005
Location: Colombo, , Sri Lanka.
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nalla Send a message via Yahoo to nalla
Default



Hi,

Thanx.I'll try that.

nalla







Similar Threads
Thread Thread Starter Forum Replies Last Post
Message box basie Classic ASP Basics 1 September 4th, 2008 01:09 PM
Message box in C# shikha09 C# 0 November 28th, 2006 01:24 AM
how to use message box? andy hee ASP.NET 1.0 and 1.1 Basics 1 April 18th, 2006 04:53 AM
Yes No Message box dbartelt Access 7 October 28th, 2005 08:16 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.