#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Posts
    91
    Rep Power
    12

    Question ASP.NET: Problems with CustomValidator...


    Hi!

    I have a litte problem with my CustomValidator.


    What my CustomValidator should do:
    The CustomValidator should check if 2 textboxes are empty..
    if yes he should diplay a message.


    This is my code:

    Code:
    <asp:customvalidator id="CustomValidator1" runat="server" ErrorMessage="Sie müssen min. 1 Telefonnummer angeben"
    		Display="Static" OnServerValidate="ValidateExistanceOfPhones"></asp:customvalidator></P>

    Code:
    	<script runat="server">
    		void ValidateExistanceOfPhones(object source, ServerValidateEventArgs args)
    		{
    			args.IsValid = !((m_txtTelephoneNumber.Text.Length == 0) && (m_txtMobileNumber.Text.Length == 0));
    		}
    	</script>


    the calidator check ValidateExistanceOfPhones. but when args.IsValid = false the message isn't
    shown. What is the problem??!
    Make I something wrong?

    2. quastion: is it possible to check the state of the 2 textboxes on the client side?
    when YES how?



    best regards,


    gicio
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Location
    Redmond, WA
    Posts
    218
    Rep Power
    14
    The URL below should answer both of your questions.

    http://samples.gotdotnet.com/quickst...r8.aspx&font=3
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Posts
    91
    Rep Power
    12
    Big THX to sano!!!!!!!!!!!





    regards,


    gicio

IMN logo majestic logo threadwatch logo seochat tools logo