C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




validatore controll space problem


Posted Date: 20 Aug 2008      Total Responses: 2

Posted By: gunjan       Member Level: Bronze     Points: 1


i m new to asp validator controll. what i want i have one text box for email and i have to validate it for it should not be blank and it should be valid for that i have taken RequiredFieldValidator and RegularExpressionValidator but the problem is that it is showing space where i have put these controll. i have email text box below that in new row i have these controll and in next row i have one other text box but it is showing space between these two text box how to remove that one?



Responses

Author: ANIL PANDEY    20 Aug 2008Member Level: DiamondRating:     Points: 6
hi,

u can use the java script for validating the control.
u need not to use the Validator..

u can refer the following code..



function CheckNull()
{
var IsEmailValid=null;
var EMailValue=null;
var ConfirmEmailValue=null;
var EMailValueToCompare=null;
var ConfirmEMailValueToCompare=null;



var PassowrdValueLength=null;
PassowrdValueLength=document.getElementById('ctl00_ContentPlaceHolder1_txtPassword').value;
PassowrdValueLength= PassowrdValueLength.replace( /^\s+/g, "" ); // strip leading
PassowrdValueLength= PassowrdValueLength.replace( /\s+$/g, "" ); // strip trailing

FirstName=CheckNullValue('ctl00_ContentPlaceHolder1_txtFirstName');
LastName=CheckNullValue('ctl00_ContentPlaceHolder1_txtLastName');
Phone=CheckNullValue('ctl00_ContentPlaceHolder1_txtPhone');
Company=CheckNullValue('ctl00_ContentPlaceHolder1_txtCompany');


EMailValue=CheckNullValue('ctl00_ContentPlaceHolder1_txtEmail');
ConfirmEmailValue=CheckNullValue('ctl00_ContentPlaceHolder1_txtConfirmEmail');

if (FirstName=='0') //NULL
{
alert('Please enter first name.');
document.getElementById('ctl00_ContentPlaceHolder1_txtFirstName').value='';
document.getElementById('ctl00_ContentPlaceHolder1_txtFirstName').focus();
return false;
}
else if (LastName=='0') //NULL
{
alert('Please enter last name.');
document.getElementById('ctl00_ContentPlaceHolder1_txtLastName').value='';
document.getElementById('ctl00_ContentPlaceHolder1_txtLastName').focus();
return false;

else
{
IsEmailValid=ValidateEmail('ctl00_ContentPlaceHolder1_txtEmail');
if (IsEmailValid=='0')
{
alert("The E-mail address you have entered is not valid. Please reenter.");
document.getElementById('ctl00_ContentPlaceHolder1_txtEmail').focus();
return false;
}
else if (IsEmailValid=='1')
{

var stateindex=null;
var countryindex=null;
var stateval=null;
var countryval=null;

stateval=document.getElementById('stateSelect');
countryval=document.getElementById('countrySelect');


}
return true;
}
}
}

Regards
Anil



Author: gunjan    20 Aug 2008Member Level: BronzeRating:     Points: 1
thank to reply but i have to use validatecontroll only not javascript validation then what to do?


Post Reply
You must Sign In to post a response.
Next : Call Javascript
Previous : How to read FingerPrint for Authentication
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

SPOC

Contact Us    Privacy Policy    Terms Of Use