Problem showing confirm dialog on button webcontrol's onclick even

Discussion in 'ASP .Net' started by =?Utf-8?B?VGFydW4gVXBhZGh5YXlh?=, Jun 1, 2005.

  1. Hi,
    I am facing strange problem
    I read Scott mitchell's article about ASP.NET and javascript at

    http://www.msdn.microsoft.com/libra...ibrary/en-us/dnaspp/html/clientsidescript.asp

    where he has talked about creating a base class for displaying alerts and
    confirms after and before postbacks respectively.

    I used that Base class to inherit on of my code behind classes and and i
    also called the method to attach a confirm (javascript method ) script on a
    button's onclick event .
    The page works fine so long as there are no validations on the page but as
    soon as i incorporate validations the confirm box still apears but the page
    validations are skipped and the form is posted back.

    This happnes since asp.net also inserts some code for validation after my
    code for client side validation methods
    it looks somethings like this

    onclick='return confirm(message);if (typeof(Page_ClientValidate) ==
    'function') Page_ClientValidate(); '

    I feel is somehow i can insert my confirm script after the code inserted by
    asp.net , then propably my problem is solved.


    Please help.

    Thanks and Regards

    Tarun Upadhyaya
    MCP (VB.NET & SQL Server 2000)
     
    =?Utf-8?B?VGFydW4gVXBhZGh5YXlh?=, Jun 1, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?VGFydW4gVXBhZGh5YXlh?=

    Peter Blum Guest

    Let's change your logic slightly:

    onclick='if (!confirm(message)) return false;if (typeof(Page_ClientValidate)
    == 'function') Page_ClientValidate(); '

    --- Peter Blum
    www.PeterBlum.com
    Email:
    Creator of "Professional Validation And More" at
    http://www.peterblum.com/vam/home.aspx

    "Tarun Upadhyaya" <t a r u n u p a d h y a y a @ y a h o o . c o . i n>
    wrote in message news:...
    > Hi,
    > I am facing strange problem
    > I read Scott mitchell's article about ASP.NET and javascript at
    >
    > http://www.msdn.microsoft.com/libra...ibrary/en-us/dnaspp/html/clientsidescript.asp
    >
    > where he has talked about creating a base class for displaying alerts and
    > confirms after and before postbacks respectively.
    >
    > I used that Base class to inherit on of my code behind classes and and i
    > also called the method to attach a confirm (javascript method ) script on
    > a
    > button's onclick event .
    > The page works fine so long as there are no validations on the page but as
    > soon as i incorporate validations the confirm box still apears but the
    > page
    > validations are skipped and the form is posted back.
    >
    > This happnes since asp.net also inserts some code for validation after my
    > code for client side validation methods
    > it looks somethings like this
    >
    > onclick='return confirm(message);if (typeof(Page_ClientValidate) ==
    > 'function') Page_ClientValidate(); '
    >
    > I feel is somehow i can insert my confirm script after the code inserted
    > by
    > asp.net , then propably my problem is solved.
    >
    >
    > Please help.
    >
    > Thanks and Regards
    >
    > Tarun Upadhyaya
    > MCP (VB.NET & SQL Server 2000)
    >
     
    Peter Blum, Jun 1, 2005
    #2
    1. Advertising

  3. Re: Problem showing confirm dialog on button webcontrol's onclick

    Oh man, that was so simple.
    Thanks a lot Mr Blum.
    I had seen you validation controls and beleive me, they are rocking.

    Thanks again you have saved many days.


    --
    Tarun Upadhyaya
    MCP (VB.NET & SQL Server 2000)
    NB: If you find my post helpful pls click the yes button on top.


    "Peter Blum" wrote:

    > Let's change your logic slightly:
    >
    > onclick='if (!confirm(message)) return false;if (typeof(Page_ClientValidate)
    > == 'function') Page_ClientValidate(); '
    >
    > --- Peter Blum
    > www.PeterBlum.com
    > Email:
    > Creator of "Professional Validation And More" at
    > http://www.peterblum.com/vam/home.aspx
    >
    > "Tarun Upadhyaya" <t a r u n u p a d h y a y a @ y a h o o . c o . i n>
    > wrote in message news:...
    > > Hi,
    > > I am facing strange problem
    > > I read Scott mitchell's article about ASP.NET and javascript at
    > >
    > > http://www.msdn.microsoft.com/libra...ibrary/en-us/dnaspp/html/clientsidescript.asp
    > >
    > > where he has talked about creating a base class for displaying alerts and
    > > confirms after and before postbacks respectively.
    > >
    > > I used that Base class to inherit on of my code behind classes and and i
    > > also called the method to attach a confirm (javascript method ) script on
    > > a
    > > button's onclick event .
    > > The page works fine so long as there are no validations on the page but as
    > > soon as i incorporate validations the confirm box still apears but the
    > > page
    > > validations are skipped and the form is posted back.
    > >
    > > This happnes since asp.net also inserts some code for validation after my
    > > code for client side validation methods
    > > it looks somethings like this
    > >
    > > onclick='return confirm(message);if (typeof(Page_ClientValidate) ==
    > > 'function') Page_ClientValidate(); '
    > >
    > > I feel is somehow i can insert my confirm script after the code inserted
    > > by
    > > asp.net , then propably my problem is solved.
    > >
    > >
    > > Please help.
    > >
    > > Thanks and Regards
    > >
    > > Tarun Upadhyaya
    > > MCP (VB.NET & SQL Server 2000)
    > >

    >
    >
    >
     
    =?Utf-8?B?VGFydW4gVXBhZGh5YXlh?=, Jun 2, 2005
    #3
  4. =?Utf-8?B?VGFydW4gVXBhZGh5YXlh?=

    Peter Blum Guest

    Re: Problem showing confirm dialog on button webcontrol's onclick

    You are welcome, Tarun. My validation controls support a confirm prompt
    feature too. If you are trying to save time, having tools that avoid custom
    coding and hacks will really help.

    --- Peter Blum
    www.PeterBlum.com
    Email:
    Creator of "Professional Validation And More" at
    http://www.peterblum.com/vam/home.aspx

    "Tarun Upadhyaya" <t a r u n u p a d h y a y a @ y a h o o . c o . i n>
    wrote in message news:...
    > Oh man, that was so simple.
    > Thanks a lot Mr Blum.
    > I had seen you validation controls and beleive me, they are rocking.
    >
    > Thanks again you have saved many days.
    >
    >
    > --
    > Tarun Upadhyaya
    > MCP (VB.NET & SQL Server 2000)
    > NB: If you find my post helpful pls click the yes button on top.
    >
    >
    > "Peter Blum" wrote:
    >
    >> Let's change your logic slightly:
    >>
    >> onclick='if (!confirm(message)) return false;if
    >> (typeof(Page_ClientValidate)
    >> == 'function') Page_ClientValidate(); '
    >>
    >> --- Peter Blum
    >> www.PeterBlum.com
    >> Email:
    >> Creator of "Professional Validation And More" at
    >> http://www.peterblum.com/vam/home.aspx
    >>
    >> "Tarun Upadhyaya" <t a r u n u p a d h y a y a @ y a h o o . c o . i n>
    >> wrote in message
    >> news:...
    >> > Hi,
    >> > I am facing strange problem
    >> > I read Scott mitchell's article about ASP.NET and javascript at
    >> >
    >> > http://www.msdn.microsoft.com/libra...ibrary/en-us/dnaspp/html/clientsidescript.asp
    >> >
    >> > where he has talked about creating a base class for displaying alerts
    >> > and
    >> > confirms after and before postbacks respectively.
    >> >
    >> > I used that Base class to inherit on of my code behind classes and and
    >> > i
    >> > also called the method to attach a confirm (javascript method ) script
    >> > on
    >> > a
    >> > button's onclick event .
    >> > The page works fine so long as there are no validations on the page but
    >> > as
    >> > soon as i incorporate validations the confirm box still apears but the
    >> > page
    >> > validations are skipped and the form is posted back.
    >> >
    >> > This happnes since asp.net also inserts some code for validation after
    >> > my
    >> > code for client side validation methods
    >> > it looks somethings like this
    >> >
    >> > onclick='return confirm(message);if (typeof(Page_ClientValidate) ==
    >> > 'function') Page_ClientValidate(); '
    >> >
    >> > I feel is somehow i can insert my confirm script after the code
    >> > inserted
    >> > by
    >> > asp.net , then propably my problem is solved.
    >> >
    >> >
    >> > Please help.
    >> >
    >> > Thanks and Regards
    >> >
    >> > Tarun Upadhyaya
    >> > MCP (VB.NET & SQL Server 2000)
    >> >

    >>
    >>
    >>
     
    Peter Blum, Jun 2, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lakshmi Murthy
    Replies:
    1
    Views:
    286
    Ken Cox [Microsoft MVP]
    May 12, 2004
  2. Replies:
    0
    Views:
    227
  3. @sh
    Replies:
    4
    Views:
    112
  4. Replies:
    2
    Views:
    278
  5. Mel
    Replies:
    1
    Views:
    127
    David Dorward
    Jul 12, 2006
Loading...

Share This Page