Regarding Page_ClientValidate() function

Discussion in 'ASP .Net' started by =?Utf-8?B?RGVlcHNvbiBUaG9tYXM=?=, May 12, 2006.

  1. 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
     
    =?Utf-8?B?RGVlcHNvbiBUaG9tYXM=?=, May 12, 2006
    #1
    1. Advertising

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

    Brock Allen Guest

    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.
    >
     
    Brock Allen, May 13, 2006
    #2
    1. Advertising

  3. =?Utf-8?B?RGVlcHNvbiBUaG9tYXM=?=

    Saurabh Pant

    Joined:
    Jun 22, 2007
    Messages:
    1
    Page_ClientValidate Validation check

    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: Jun 22, 2007
    Saurabh Pant, Jun 22, 2007
    #3
  4. =?Utf-8?B?RGVlcHNvbiBUaG9tYXM=?=

    ademoo

    Joined:
    Aug 22, 2008
    Messages:
    1
    i've read this topic and it saved my life :) thanks for this one.
     
    ademoo, Aug 22, 2008
    #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. Ante Perkovic

    How to get rid of Page_ClientValidate() ?

    Ante Perkovic, Jul 1, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    6,150
    William F. Robertson, Jr.
    Jul 1, 2003
  2. Leif K-Brooks
    Replies:
    9
    Views:
    315
    Jeff Epler
    Jun 23, 2004
  3. Mosas

    Doubt regarding exec function

    Mosas, Mar 22, 2005, in forum: Python
    Replies:
    1
    Views:
    333
    Diez B. Roggisch
    Mar 22, 2005
  4. praba kar

    doubt regarding main function

    praba kar, Apr 7, 2005, in forum: Python
    Replies:
    0
    Views:
    325
    praba kar
    Apr 7, 2005
  5. Bob
    Replies:
    6
    Views:
    2,778
Loading...

Share This Page