RequiredFieldValidator--write code in javascript

Answer Posted / amit das

function validate()
{
if(document.getElementById("NameId").value == null)
alert("Please enter the name");
document.getElementById("NameId").focus();
return false;
}

or

function validate()
{
with(document.formname)
{
txtboxid.value == ""
alert("Please enter value");
txtboxid.focus();
return false;
}
}

or we can use

document.form.txtboxid.value

instead of

document.getElementById("NameId").value

Is This Answer Correct ?    7 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is sql data source control in asp.net?

771


Why web api is better than wcf?

761


When you are running a component within ASP.NET, what process is it running within on Windows XP? Windows 2000? Windows 2003?

779


Explain how can you debug your .net application?

709


How does windows service lifecycle differ from a .standard. Exe?

712


Can you nest updatepanel within each other?

741


What does occur first in ASP.Net, Authentication or Authorization?

762


Which of the following .NET framework supports Web API?

839


What is application and session in asp.net?

693


How you can stop the validation of ASP.NET controls from client side?

748


What is the function of new view engine in asp.net? : asp.net mvc

734


What is strong-typing versus weak-typing?

801


What’s the catch?

833


Where web.config file is used?

755


Is asp.net and .net same?

722