RequiredFieldValidator--write code in javascript

Answers were Sorted based on User's Feedback



RequiredFieldValidator--write code in javascript..

Answer / srinivasan

function validate()
{
var Name = document.getElementById("txtName");
if( Name.value=="")
{
alert("Please enter the Name");
return false;
}
}

button OnClick() we hav to cal this function

Is This Answer Correct ?    9 Yes 1 No

RequiredFieldValidator--write code in javascript..

Answer / 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

RequiredFieldValidator--write code in javascript..

Answer / gangadhar

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

in button OnClick() we hav to cal this function

Is This Answer Correct ?    6 Yes 3 No

Post New Answer

More ASP.NET Interview Questions

how to get modified rows from Dataset

1 Answers   CGI,


What?s the difference between Response.Write() andResponse.Output.Write()?

7 Answers   Atos Origin, IBM,


What is meant by ispostback in asp net?

0 Answers  


Differentiate the session object and application object?

0 Answers  


What is the file extension of web service?

0 Answers  






What is difference between cache and session?

0 Answers  


What is the main difference between hash table and Dictionary?

3 Answers   CSC,


what is the trace in ASP.NET

4 Answers  


Explain the difference between asp & asp.net.

0 Answers  


what is PostBack Property exactly ? when It Returns True? when it Returns False?

1 Answers  


What are the Types of chaching. How to implement caching

0 Answers   Microsoft,


What are clr?cts?cls?

4 Answers   e4e, HCL, Microsoft, Tata Communications,


Categories