Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Regarding Page_ClientValidate() function

Reply
Thread Tools

Regarding Page_ClientValidate() function

 
 
=?Utf-8?B?RGVlcHNvbiBUaG9tYXM=?=
Guest
Posts: n/a
 
      05-12-2006
Hi,
How can we identify due to which validator control the
Page_ClientValidate() method is returning false.

why iam asking this coz in my page iam using lotz of regular expression
validators and on the click of button if iam checking whatz the return value
of Page_ClientValidate() function iam getting false.

Now on click of a checkbox i disables a couple of textboxes. i attached
regular expression validators to these textboxes. if these textboxes are
enabled and contains proper data then also Page_ClientValidate() function
returns false. even i wont get any message from the validators. if i clicked
on the checkbox and disable the textboxes then Page_ClientValidate()
function returns true.

can anybody tell me whatz really wrong...

waiting for the reply.

--
Deepson Thomas

 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      05-13-2006
You can iterate over the Page.Validators collection manually and check IsValid
to identify which one(s) are failing.

-Brock
http://staff.develop.com/ballen


> Hi,
> How can we identify due to which validator control the
> Page_ClientValidate() method is returning false.
> why iam asking this coz in my page iam using lotz of regular
> expression validators and on the click of button if iam checking whatz
> the return value of Page_ClientValidate() function iam getting false.
>
> Now on click of a checkbox i disables a couple of textboxes. i
> attached regular expression validators to these textboxes. if these
> textboxes are enabled and contains proper data then also
> Page_ClientValidate() function returns false. even i wont get any
> message from the validators. if i clicked on the checkbox and disable
> the textboxes then Page_ClientValidate() function returns true.
>
> can anybody tell me whatz really wrong...
>
> waiting for the reply.
>



 
Reply With Quote
 
 
 
 
Saurabh Pant Saurabh Pant is offline
Junior Member
Join Date: Jun 2007
Posts: 1
 
      06-22-2007
This can be achieved easily by having diffferent controls(Button, checkbox, etc.) set their ValidationGroup property set to some value. Match this with the ValidationGroup property of the Validators(CustomValidator, RequireFieldValidator, etc.) Next, write your javascript functions to do something on different events of the control(OnClick, etc.) and add the 'Page_ClientValidate' check to see if the validations(Custom, RequireField) are complete in the page. Example below, will display confirm message for btn1 click, if validations associated with it are complete, and NOT btn2 validations. You can also use Page_ClientValidate(' '); with empty string, if you want to check for the controls validations with no ValidationGroup assigned.

function btnOnClick(){
var validated = Page_ClientValidate('group1');
if (validated){
return confirm('Are you sure you want...');
}
}

<asp:Button ID="btn1" runat="server" ClickOnce="true" Text="ClickMe" CausesPostback="true" CausesValidation="true" ValidationGroup="group1" OnClientClick = "return btnOnClick();"/>

<asp:Button ID="btn2" runat="server" ClickOnce="true" Text="ClickMe" CausesPostback="true" CausesValidation="true" ValidationGroup="group2" OnClientClick = "return btnOnClick();"/>

Happy Programming!
 

Last edited by Saurabh Pant; 06-22-2007 at 01:59 PM..
Reply With Quote
 
ademoo ademoo is offline
Junior Member
Join Date: Aug 2008
Posts: 1
 
      08-22-2008
i've read this topic and it saved my life thanks for this one.
 
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
Function versus pointer to function, in context of std::function,huh? Alf P. Steinbach C++ 10 07-27-2011 05:51 AM
Function pointer to void function and int function Giannis Papadopoulos C Programming 5 09-05-2005 09:06 PM
How override ALL function calls? (Is there a "function call function"?) seberino@spawar.navy.mil Python 2 08-01-2005 12:38 PM
write a function such that when ever i call this function in some other function .it should give me tha data type and value of calling function parameter komal C++ 6 01-25-2005 11:13 AM
Passing a C++ object's member function to a C function expecing a function pointer! James Vanns C++ 7 01-21-2004 02:39 AM



Advertisments