user control issue

G

Guest

Hi all,
If I developed a phone user control which has requiredfieldvalidator,
regularexpressionvalidator etc. The quesiton is if on a web form which have
three
phone fields and only any one of them is required, it seems in this case
user control is not good choice.
The only thing I can think of is eliminate the requiredfieldvalidator in
user control,
deal with required field in aspx page for the above case, am I right?
Any other ways?
 
D

dbarkol

Sounds like you don't really need the user controls at all. Just place
the text boxes for the phone numbers on the form itself and leverage
the custom validator control and regular expresssion validator control
to determine what is required and valid.

David Barkol
www.neudesic.com
 
G

Guest

I had a similar problem once and used the custom validator control to solve
it. That way you can write your own javascript to do the validation for you:
evaluate all three phone numbers to see at least one, or the one you want, is
valid.

Regards,

- Chase
 
S

Steven Cheng[MSFT]

Hi Betty,

Do you mean you created an ascx usercontrol for the functionality(a input
field with some validation controls associated with it)? Regarding on the
issue you mentiond, I think if you do want to make it a encapsulated and
reusable unit, we can consider use Custom Web Server control to encapsulate
them(instead of ascx user control), that'll be more flexible for reusing.
Also, if you're worried about the problem that not each one will need the
required validation, why not provide a certain Property e.g
"NeedValidation" on the custom control to control whether to generate the
validation sub controls at runtime. Thus, our custom control's user can set
this property at design-time or at runtime.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)




--------------------
| Thread-Topic: user control issue
| thread-index: AcYi2RdvtGDwI/NpQSWFClLW3wRGDA==
| X-WBNR-Posting-Host: 64.85.224.187
| From: "=?Utf-8?B?YzY3NjIyOA==?=" <[email protected]>
| Subject: user control issue
| Date: Thu, 26 Jan 2006 16:32:02 -0800
| Lines: 12
| 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
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:373887
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Hi all,
| If I developed a phone user control which has requiredfieldvalidator,
| regularexpressionvalidator etc. The quesiton is if on a web form which
have
| three
| phone fields and only any one of them is required, it seems in this case
| user control is not good choice.
| The only thing I can think of is eliminate the requiredfieldvalidator in
| user control,
| deal with required field in aspx page for the above case, am I right?
| Any other ways?
| --
| Betty
|
 

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,770
Messages
2,569,584
Members
45,076
Latest member
OrderKetoBeez

Latest Threads

Top