Results 1 to 5 of 5

Thread: [RESOLVED] confirm javascript function is not workimng for my custom control

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2006
    Posts
    589

    Resolved [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.

  2. #2
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092

    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');";

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2006
    Posts
    589

    Re: confirm javascript function is not workimng for my custom control

    that s perfectamigo. Thank thee
    Thanks a lot for your help.

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    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!

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2006
    Posts
    589

    Re: [RESOLVED] confirm javascript function is not workimng for my custom control

    sorry
    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
  •  



Click Here to Expand Forum to Full Width