In a page there is dropdown list with the name of the
cities like Bangalore,Pune,Chennai,Other and a text box
that would enable the user to enter the name of the city if
other is selected. How to enable validation on the text box
if other is selected
Answer Posted / swetha v
Hi Friends,
I hope the below solution helps....
1. Please add the required field validator for the texbox.
2. In Page_Load method, we can add the below statement
Dropdownlist.Attributed.Add
("OnChange","javascript:ValidateOtherCity();")
Add the below javascript function on the aspx page
function ValidateOtherCity()
{
var other = window.document.getElementById
("DropdownlistName");
if(other.value == 'Other')
{
ValidatorEnable(RequiredFieldValidatorName,true);
}
else
{
ValidatorEnable(RequiredFieldValidatorName,false);
}
}
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
What is autopost?
is gateway for sms continue connected for sending sms.how?
Why is global asax is used for?
How will create assesblies at run time?
Is asp net front end or backend?
What is the use of web.config file?
What does a switch do?
What is asp.net web application?
What are the disadvantages of asp.net?
How to you can limit Access to Web API to Specific HTTP Verb?
What is difference between Server.Transfer and Response.Redirect in ASP.NET?
What are the Types of objects in ASP
Difference between Response.redirect vs server.transfer?
Explain what is the procedure to create the environment for asp.net? : asp.net mvc
Is post back in asp.net?