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 the generics and where used generics in your project?

3 Answers   CTC,


what is state management?

2 Answers  


Differentiate between early binding and late binding.

0 Answers  


What’s the catch?

0 Answers  


Explain method to handle error using HttpError in Web API?

0 Answers  






If I m using Session State Partioning where I have partitioned my session into 4 servers then how can I know that my session will be stored on which server?

1 Answers  


What is the purpose of the validation summary control? What do you need to do to prevent an error message from being displayed in a validator when a validation summary control is used? How can you display a message in both the validator and the validation summary control?

2 Answers  


Where the cookie value is stored?

0 Answers  


How does session id work?

0 Answers  


What is the maximum number of classes that can be contained in one dll file?

0 Answers  


What is versioning in .NET?

1 Answers   Syntax Softtech, Wipro,


What is session state server?

0 Answers  


Categories