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
Define a multilingual website?
Explain server side state management system.
What is difference between session and viewstate?
What is .net framework and what are the main components of it?
Define view state.
What do you mean by View State and what is its role?
Is it possible to apply themes to an asp.net application? If yes, then how?
Explain transparent caching with aop?
Will the asp.net validators run in server side or client side? How do you do client-side validation in .net? How to disable validator control by client side javascript?
What is the compiled object?
What is http response header?
What are the different properties of server control that exists?
Define tracing.
What are the steps to follow to host a web application on a web server?
What are resource file and how do we generate resource file?