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 / sai krishna

In aspx page

<asp:DropDownList ID="DropDownList1" runat="server"
Width="176px">
<asp:ListItem>Pune</asp:ListItem>
<asp:ListItem>Chennai</asp:ListItem>
<asp:ListItem>Hyderabad</asp:ListItem>
<asp:ListItem>Other</asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="TextBox2"
runat="server"></asp:TextBox>

<script language="javascript" type="text/javascript">
var other1 = window.document.getElementById("TextBox2");
other1.disabled = true;
function ValidateOtherCity()
{
var other = window.document.getElementById
("DropDownList1");
var other2 = window.document.getElementById
("TextBox2");
if(other.value == 'Other')
{
other2.disabled = false;
}
else
{
other2.disabled = true;
}
}
</script>


In aspx.cs

protected void Page_Load(object sender, EventArgs e)
{
DropDownList1.Attributes.Add
("OnChange", "javascript:ValidateOtherCity();");
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is silver light when will we use silver light,

1850


What is .net remoting?

997


Is it possible to migrate visual interdev design-time controls to asp.net?

1002


What are directives in asp.net? List down all the important directives.

885


Does google crawl redirects?

915


How can u deifne the benefits and limitation of using Viewstate for state management?

1089


Is there any property names “isnavigating”?

985


Web API supports which protocol?

1329


To add a hyperlink column to the DataGrid which tag is used ?

1033


What is rending process in ASP.NET?

1030


Which ASP.NET configuration options are supported in the ASP.NET implementation on the shared web hosting platform?

1075


What is page fragment caching?

906


Can viewstate be accessed in another page?

972


Why would a company use an application service provider?

872


Where session id is stored?

934