Rquired field validator - client side problem

  • Thread starter Thread starter RA
  • Start date Start date
R

RA

Hi

How do I disable it if the user pressed a button:
asp:imagebutton id="btnHome" onclick="test()" runat="server"

What I want to have is that if someone presses this button then the required
field validator won't be activated so the user can move out of the current
page.
 
Hi,

First, you'll want an HTML button so that you can more easily add
client-side script to its click event. Then you will want to disable the
validation control by calling ValidatorEnable(RequiredFieldValidator,
false).

For more information, see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html
/aspplusvalid.asp and search within it for the text ValidatorEnable. It
includes sample code.

I hope this helps.

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer’s security.

This posting is provided "AS IS", with no warranties, and confers no rights.

--------------------
 
Yes but I have many asp buttons and if the user clickes any one of them I
would like to disable the validation. How do I add client side script to asp
buttons?


Thanks,
Ron

"Mike Moore [MSFT]" said:
Hi,

First, you'll want an HTML button so that you can more easily add
client-side script to its click event. Then you will want to disable the
validation control by calling ValidatorEnable(RequiredFieldValidator,
false).

For more information, see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html
/aspplusvalid.asp and search within it for the text ValidatorEnable. It
includes sample code.

I hope this helps.

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer's security.

This posting is provided "AS IS", with no warranties, and confers no rights.
--------------------
From: "RA" <[email protected]>
Subject: Rquired field validator - client side problem
Date: Wed, 15 Oct 2003 13:31:58 -0500
Lines: 10
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: dialup-67.27.136.33.dial1.minneapolis1.level3.net 67.27.136.33
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:184393
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Hi

How do I disable it if the user pressed a button:
asp:imagebutton id="btnHome" onclick="test()" runat="server"

What I want to have is that if someone presses this button then the required
field validator won't be activated so the user can move out of the current
page.
 
Hi,

That's a difficult subject. When you have asp buttons and validators on the
same page, the validators "take over" the button's click event and it's
tricky to get it back.

There are seven or so ways to get the click event back listed on this web
site, including sample code. Good luck.
http://authors.aspalliance.com/kenc/faq6.aspx

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer’s security.

This posting is provided "AS IS", with no warranties, and confers no rights.


--------------------
Subject: Re: Rquired field validator - client side problem
Date: Wed, 15 Oct 2003 22:10:04 -0500
Lines: 70
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Message-ID: <un#[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: dialup-67.24.71.97.dial1.minneapolis1.level3.net 67.24.71.97
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:184506
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Yes but I have many asp buttons and if the user clickes any one of them I
would like to disable the validation. How do I add client side script to asp
buttons?


Thanks,
Ron

"Mike Moore [MSFT]" said:
Hi,

First, you'll want an HTML button so that you can more easily add
client-side script to its click event. Then you will want to disable the
validation control by calling ValidatorEnable(RequiredFieldValidator,
false).

For more information, see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html
/aspplusvalid.asp and search within it for the text ValidatorEnable. It
includes sample code.

I hope this helps.

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer's security.

This posting is provided "AS IS", with no warranties, and confers no rights.
 
Back
Top