Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 different ways you would consider sending data across pages in ASP (i.e between asp to asp)?

928


Explain the difference between server control and html control.

882


How can you handle exceptions in asp.net?

998


What are the benefits of Razor View?

912


When was asp.net released?

983


Explain the steps needed to be performed in order to create an animation in xaml?

964


What is preprocessor in .net?

927


What is http post action?

960


Explain the namespace classes used in asp.net mvc? : asp.net mvc

952


What will happen if the server confugration file and the application confugration file have different values for sassion state ASP.NET?

1176


What are the components of ado.net?

909


We are using Jscriopt validations and at clint site javascript is not running that time validation would work? if yes then how it would behave?

1852


What describes a query?

874


How long does an http session last?

892


What is difference between cookies and cache?

1004