473,387 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Problem showing confirm dialog on button webcontrol's onclick even

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)

Nov 19 '05 #1
3 2389
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: PL****@PeterBlum.com
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:BF**********************************@microsof t.com...
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)

Nov 19 '05 #2
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: PL****@PeterBlum.com
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:BF**********************************@microsof t.com...
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)


Nov 19 '05 #3
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: PL****@PeterBlum.com
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:1E**********************************@microsof t.com...
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: PL****@PeterBlum.com
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:BF**********************************@microsof t.com...
> 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)
>


Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: dzeeq | last post by:
Hi, I wonder if it's possible to replace standard text on confirm-popup buttons from 'ok' and 'cancel' to some other captions. If not, is there a way to create quickly custom dialog, with only two...
1
by: Muhammad Abdullah | last post by:
Hi am having some problems with the javascript confirm. i have it working fine on one page and it doesnt even pop up at the other. The code on the working page is, private void...
13
by: Chris | last post by:
I can create Javascript confirm message boxes during page creation, etc adding them to the button attributes (many good posts on this!). But how can I add this event after the button is pressed? I...
3
by: ad | last post by:
I want user can confirm before delete records ? How can I show a confirm dialog when users press a button?
7
by: Rémi | last post by:
Hello. I have just gotten a client-side delete confirmation Javascript button to work, using this FAQ question as a basis (3rd question down, URL...
5
by: Dave | last post by:
I'm tearing my hair out over this one. Using VS 2003, inline (not code-behind), vb.net. I have a button (btnClear) that calls a vb routine that goes into sql server and truncates a table. ...
4
by: mamun | last post by:
Hi All, I have the following situation and am looking for answer in C#. I have a datagrid and putting checkbox next to each record. In the header I have a Delete button. I want users to...
5
by: GiJeet | last post by:
Hello, I'm trying to figure this code out. <input type="submit" onclick="if(!confirm('Are you sure?') return false; "... /> I know that if you return false in an event like this onclick it...
3
by: swethak | last post by:
Hi, I want to applying the styles for confirm box. For this purpose i have used below code. Here i am writting my code <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.