Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 12th, 2004, 12:53 AM
Registered User
 
Join Date: Oct 2004
Location: Pune, , India.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Custom Validator for Two text box.

hello..

I have 2 text box and I've to show an error message if both are blank. Atleast one of the two should be filled out by the user.
I tried customvalidator but it works only if the text box is not blank. Someone plz help me...:(

Thanks
Vicky
  #2 (permalink)  
Old October 13th, 2004, 07:21 AM
Friend of Wrox
 
Join Date: Jun 2004
Location: Chennai, Tamil Nadu, India.
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

what code have you written for validation in your customvalidator??

Regards
Ganesh
  #3 (permalink)  
Old October 15th, 2004, 06:41 AM
Registered User
 
Join Date: Oct 2004
Location: Pune, , India.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm bit confused how to use customvalidator for two text box.... Following is the code I'd tried....

<asp:customvalidator id="emailvalidator" Runat="server" ControlToValidate="TxtMailId" Display="Dynamic"
ClientValidationFunction="CheckTextBox" EnableClientScript="True" ErrorMessage="Please fill Name or Email Id to Search." CssClass="error">
</asp:customvalidator>

function CheckTextBox(objsrc, objArgs)
    {

        var Valid1=false;
        var EmailValue = document.Template.TxtEmail.value
        var NameValue = document.Template.TxtEmail.value
        if(EmailValue=="" && NameValue=="")
        {
            Valid1 = false;
        }
        else
        {
            Valid1 = true;
        }
        objArgs.IsValid=Valid1;
        return;
    }

Quote:
quote:Originally posted by r_ganesh76
 what code have you written for validation in your customvalidator??

Regards
Ganesh
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DDL Custom Validator AspNetGuy BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 June 6th, 2008 05:17 PM
Custom Validator against a database Steve Spicer ASP.NET 2.0 Professional 16 January 12th, 2008 06:25 AM
custom validator question kscdave Classic ASP Professional 3 April 24th, 2005 07:11 AM
Custom Validator bmains ASP.NET 1.0 and 1.1 Basics 4 December 18th, 2003 11:45 AM



All times are GMT -4. The time now is 07:53 AM.


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