ServerValidate event in DropDownList objects.

A

Antoine Oulevay

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?
 
M

Mike Moore [MSFT]

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?= <[email protected]>
Subject: ServerValidate event in DropDownList objects.
Date: Mon, 17 Nov 2003 06:26:08 -0800
Lines: 3
Message-ID: <[email protected]>
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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top