|
-
Mar 25th, 2007, 10:23 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] confirm javascript function is not workimng for my custom control
Hi
I develop a custom control inheriting from System.Web.UI.WebControls.WebParts.WebPart.
I have this code in a button in the control:
private Button btnSave = new Button();
btnSave.Text = " Save ";
btnSave.OnClientClick = "confirm('client');";
btnSave.Click += new EventHandler(btnSave_Click);
and so on
But when the user clicks on the button, I get the confirm pop up message. But even when I click Cancel there is still a postback
Do u have a trick for me pls?
Thanks
Thanks a lot for your help.
-
Mar 26th, 2007, 06:25 AM
#2
Re: confirm javascript function is not workimng for my custom control
I think you just need to catch the result from the confirm to stop the page from being submitted.
Code:
btnSave.OnClientClick = "return confirm('client');";
-
Mar 26th, 2007, 10:53 AM
#3
Thread Starter
Fanatic Member
Re: confirm javascript function is not workimng for my custom control
that s perfectamigo. Thank thee
Thanks a lot for your help.
-
Mar 26th, 2007, 12:00 PM
#4
Re: confirm javascript function is not workimng for my custom control
Unless you have any further questions, please go to the "Thread Tools" menu above the first post and click "Mark Thread Resolved"; this will let other forum users know your question has been answered. Thanks!
-
Mar 26th, 2007, 08:39 PM
#5
Thread Starter
Fanatic Member
Re: [RESOLVED] confirm javascript function is not workimng for my custom control
Thanks a lot for your help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|