ServerValidate event in DropDownList objects.

Discussion in 'ASP .Net Web Controls' started by Antoine Oulevay, Nov 17, 2003.

  1. Hello
    I'm making a Web application in ASP.Net, and I've got some problems using several DropDownList controls. A CustomValidator control is assigned to each DropDownList control. And a validating function is emplemented for each of the ServerValidate event of the CustomValidator controls. Evry DropDownList has his AutoPostBack property set to "true", and the Lists are initialized with some values, and the first of these values is an empty string. By tracing the execution of my page_load procedure, I saw that by validating the control, if the empty string is selected in a DrpDownList, his ServerValidate event isn't called
    My question is, why doesn't the system handle empty string or even a space (" ") the same way as other strings?
    Antoine Oulevay, Nov 17, 2003
    #1
    1. Advertising

  2. Hi,

    This feature is not very popular (skipping validation on blank controls).
    There is a workaround for custom controls. Don't set their
    "ControlToValidate". Leave it blank. Then the custom validator will run
    with every post back. The client/server code will have to be coded to
    validate the proper control.

    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.


    --------------------
    > Thread-Topic: ServerValidate event in DropDownList objects.
    > thread-index: AcOtFr3r94b4eY3hQd+u4Oxp9o81xw==
    > X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
    > From: =?Utf-8?B?QW50b2luZSBPdWxldmF5?= <>
    > Subject: ServerValidate event in DropDownList objects.
    > Date: Mon, 17 Nov 2003 06:26:08 -0800
    > Lines: 3
    > Message-ID: <>
    > MIME-Version: 1.0
    > Content-Type: text/plain;
    > charset="Utf-8"
    > Content-Transfer-Encoding: 7bit
    > X-Newsreader: Microsoft CDO for Windows 2000
    > Content-Class: urn:content-classes:message
    > Importance: normal
    > Priority: normal
    > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
    > Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
    > NNTP-Posting-Host: TK2MSFTCMTY1 10.40.1.180
    > Path: cpmsftngxa06.phx.gbl!cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl
    > Xref: cpmsftngxa06.phx.gbl

    microsoft.public.dotnet.framework.aspnet.webcontrols:16218
    > X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
    >
    > Hello,

    I'm making a Web application in ASP.Net, and I've got some problems using
    several DropDownList controls. A CustomValidator control is assigned to
    each DropDownList control. And a validating function is emplemented for
    each of the ServerValidate event of the CustomValidator controls. Evry
    DropDownList has his AutoPostBack property set to "true", and the Lists are
    initialized with some values, and the first of these values is an empty
    string. By tracing the execution of my page_load procedure, I saw that by
    validating the control, if the empty string is selected in a DrpDownList,
    his ServerValidate event isn't called.
    My question is, why doesn't the system handle empty string or even a space
    (" ") the same way as other strings?
    >
    Mike Moore [MSFT], Nov 18, 2003
    #2
    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. headware
    Replies:
    2
    Views:
    586
    headware
    Mar 9, 2005
  2. =?Utf-8?B?RGF2ZQ==?=

    attaching an event to ServerValidate

    =?Utf-8?B?RGF2ZQ==?=, May 15, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    402
    =?Utf-8?B?S2VpdGg=?=
    May 15, 2007
  3. Aamir Ghanchi
    Replies:
    1
    Views:
    483
    Aamir Ghanchi
    Oct 2, 2007
  4. Andy B
    Replies:
    0
    Views:
    977
    Andy B
    Jan 23, 2009
  5. Andy B.
    Replies:
    0
    Views:
    768
    Andy B.
    Feb 20, 2009
Loading...

Share This Page