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 new features added from ASP to ASP.NET?
What's the difference between viewstate and sessionstate?
Define a static class?
Explain the steps needed to be performed in order to create an animation in xaml?
What is the difference between the asp and asp.net?
a web application needs to be created to accept the product name and quantity of a toy from a customer. After the customer has entered the product name the application needs to display the discounted price of the product to the customer (company is offering 35% discount on all products). The application should allow the customer to select the product name from a list box. and also while i'm data binding to a label with custom data binding with some declarations : "The Discounted Price is "+((System.Convert.todouble(lblprodprice.text)*(system.convert.todouble(txtqty.text)) - ((System.convert.todouble(lblprodprice.text)*(system.convert.todouble(txtqty.text)*0.35)). Where i need to give this declaration in asp.net 2.0.
How many types of state management are there in asp net?
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?
What is the use of response redirect in asp.net?
What is a global postback url?
How many types of sessions in asp.net?
If you want to bind the columns manually within the asp:datagrid tags what kind of tags you have to add.
What is the purpose of using MVC programming pattern in ASP.NET?
What is the difference between union and structure?
How can you implement encapsulation in asp.net?