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 are the advantages and limitations of query string?
how can we create wcf in asp.net and how can we cll that in to asp.net application?plsss tel me each step clearly
Define static member?
What is difference between asp.net and asp.net mvc? : Asp.Net MVC
What is the difference between dispose() and finalize()?
What are the event handlers that we can have in global.asax file?
how can create login from create and written conde in asp.net
What is the difference between adding reference in solution explorer and adding references by using ?
what cut off mark for po's,what questions they asked for interview?
How to implement role based security in asp.net mvc? : Asp.Net MVC
What is jade template engine?
How does http session work?
If I have more than one version of one assemblies, then how will I use old version (how/where to specify version number?) In my application?
Explain the server control events of asp.net ?
What is applicatio domain?