Wrox Programmer Forums
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 5th, 2005, 05:01 PM
Authorized User
Join Date: May 2005
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Validation Controls

I have 2 textboxes on a page, but both textboxes form part of a string which is stored in the DB (called Staffware Ref):
<asp:textbox id="txtConnStaffwareRef1" runat="server" CssClass="ihd-input" MaxLength="3" Width="27px"></asp:textbox>
<asp:textbox id="txtConnStaffwareRef2" runat="server" CssClass="ihd-input" MaxLength="5" Width="40px"></asp:textbox>

So the textboxes are rendered on the screen as textbox1 (followed by a dash) then textbox2. They form 2 halfs of the resultant string.

Is it possible to check that both textboxes are populated at the same time and NOT as 2 different textboxes? So the message would simply say "Problem with Staffware Ref" if either textbox1 or textbox2 were empty.
Thanks. Andy.

Andy has a keen interest in home security and home alarm systems. Improve your home security now by going to the The Best Home Security Guide.
Old June 6th, 2005, 12:17 AM
Friend of Wrox
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts

IF textbox1 = "" OR textbox2 = "" THEN
   Do Something ...
End IF

Old June 9th, 2005, 08:49 AM
planoie's Avatar
Friend of Wrox
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

Using the validation controls for client-side validation if you use required field validators on each textbox you'll end up with two messages. So you'll probably want to use the custom validator control that checks both but only shows a single message for either textbox error condition.

Old June 9th, 2005, 09:19 AM
Authorized User
Join Date: May 2005
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts

Ok thanks.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Validation controls and postback sdi126 ASP.NET 2.0 Basics 5 November 11th, 2007 12:08 PM
Validation controls in datalist anujrathi ASP.NET 1.0 and 1.1 Professional 4 July 26th, 2006 03:32 PM
validation involving 2 controls Renu ASP.NET 1.0 and 1.1 Basics 24 December 21st, 2004 06:33 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.