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

What is web api and why to use it?

0 Answers  


what is difference between const, static and readonly?

2 Answers   TVS,


How can we create a website?

0 Answers  


What is the difference between “Web.config” and “Machine.Config”?

0 Answers  


How do you specify whether your data should be passed as Query string and Forms (Mainly about POST and GET)

2 Answers  






What’s the catch?

0 Answers  


what is the deference between dataset and data adapter?

4 Answers   TCS,


Usage of web.configuration ?

3 Answers   Microsoft,


What is difference between web api and web services?

0 Answers  


I have one application, one user purchase some products in my application? and another person came he is also purchase some products?how can we identify which user purchase which items? my answer is by using session id? but i dont know how? can u give me programming for that?

1 Answers  


Is global asax mandatory?

0 Answers  


How do you change the session time-out value?

0 Answers   TryTechnicals Pvt Ltd,


Categories