Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Problem showing confirm dialog on button webcontrol's onclick even

Reply
Thread Tools

Problem showing confirm dialog on button webcontrol's onclick even

 
 
=?Utf-8?B?VGFydW4gVXBhZGh5YXlh?=
Guest
Posts: n/a
 
      06-01-2005
Hi,
I am facing strange problem
I read Scott mitchell's article about ASP.NET and javascript at

http://www.msdn.microsoft.com/librar...sidescript.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)

 
Reply With Quote
 
 
 
 
Peter Blum
Guest
Posts: n/a
 
      06-01-2005
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: http://www.velocityreviews.com/forums/(E-Mail Removed)
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:(E-Mail Removed)...
> Hi,
> I am facing strange problem
> I read Scott mitchell's article about ASP.NET and javascript at
>
> http://www.msdn.microsoft.com/librar...sidescript.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)
>



 
Reply With Quote
 
 
 
 
=?Utf-8?B?VGFydW4gVXBhZGh5YXlh?=
Guest
Posts: n/a
 
      06-02-2005
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: (E-Mail Removed)
> 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:(E-Mail Removed)...
> > Hi,
> > I am facing strange problem
> > I read Scott mitchell's article about ASP.NET and javascript at
> >
> > http://www.msdn.microsoft.com/librar...sidescript.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)
> >

>
>
>

 
Reply With Quote
 
Peter Blum
Guest
Posts: n/a
 
      06-02-2005
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: (E-Mail Removed)
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:(E-Mail Removed)...
> 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: (E-Mail Removed)
>> 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:(E-Mail Removed)...
>> > Hi,
>> > I am facing strange problem
>> > I read Scott mitchell's article about ASP.NET and javascript at
>> >
>> > http://www.msdn.microsoft.com/librar...sidescript.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)
>> >

>>
>>
>>



 
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
retaining save dialog box even after clicking save button hell2heaven Java 0 10-26-2008 07:18 PM
Changing button labels on Confirm dialog Mel Javascript 1 07-12-2006 08:52 PM
RequiredFieldValidator not working with Button "onclick" Confirm. michaelg83@yahoo.com ASP .Net Web Controls 0 06-20-2006 02:29 PM
button.onclick = new Function("func2()") + button.onclick foldface@yahoo.co.uk Javascript 2 09-26-2005 08:13 AM
Button onClick + Confirm problem... @sh Javascript 4 08-19-2005 10:04 AM



Advertisments