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


Please Help Members By Posting Answers For Below Questions

What are the advantages and limitations of query string?

574


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

1548


Define static member?

541


What is difference between asp.net and asp.net mvc? : Asp.Net MVC

489


What is the difference between dispose() and finalize()?

501






What are the event handlers that we can have in global.asax file?

536


how can create login from create and written conde in asp.net

1783


What is the difference between adding reference in solution explorer and adding references by using ?

580


what cut off mark for po's,what questions they asked for interview?

1425


How to implement role based security in asp.net mvc? : Asp.Net MVC

441


What is jade template engine?

578


How does http session work?

525


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?

524


Explain the server control events of asp.net ?

543


What is applicatio domain?

576