function FillCity() { str = document.all["MyDropDownList"].value ; document.all["DropDownList"].length=0; soption = "Select City" st = new Option(soption,""); document.all["DropDownList"].add(st) for (i=1;i
function FillCity()
{
str = document.all["MyDropDownList"].value ;
document.all["DropDownList"].length=0;
soption = "Select City"
st = new Option(soption,"");
document.all["DropDownList"].add(st)
for (i=1;i<8;i++){
if (JCountry[i] == str){
soption = JCity[i];
st = new Option(soption,soption);
document.all["DropDownList"].add(st)
}
}
}
Here is the code. <script runat="server" > public void Page_Load ( object sender, EventArgs e) { MyDropDownList.Attributes.Add("OnChange", "FillCity()") ; MyDropDownList.Items.Add(new ListItem("Selecy Country", "")); MyDropDownList.Items.Add(new ListItem("India", "IND")); MyDropDownList.Items.Add(new ListItem("United Kingdom", "UK")); MyDropDownList.Items.Add(new ListItem("United States", "US")); MyDropDownList.Items.Add(new ListItem("France", "FR")); MyDropDownList.Items.Add(new ListItem("Srilanka", "SR")); DropDownList.Items.Add(new ListItem("Selecy City", "")); String strString; strString = "<script language='JavaScript' >"; strString += "JCountry = new Array(15);"; strString += "JCountry[1] = 'IND';"; strString += "JCountry[2] = 'IND';"; strString += "JCountry[3] = 'US';"; strString += "JCountry[4] = 'US';"; strString += "JCountry[5] = 'US';"; strString += "JCountry[6] = 'UK';"; strString += "JCountry[7] = 'UK';"; strString += "JCity = new Array(20);"; strString += "JCity[1] = 'Mumbai';"; strString += "JCity[2] = 'Pune';"; strString += "JCity[3] = 'New York';"; strString += "JCity[4] = 'Chicago';"; strString += "JCity[5] = 'Washignton';"; strString += "JCity[6] = 'London';"; strString += "JCity[7] = 'Leeds';"; strString += "<" + "/" + "script>"; Response.Write(strString); } public void alphaSubmit(object sender , EventArgs e) {
} </script>
<script language="JavaScript" > function FillCity() { str = document.all["MyDropDownList"].value ; document.all["DropDownList"].length=0; soption = "Select City" st = new Option(soption,""); document.all["DropDownList"].add(st) for (i=1;i<8;i++){ if (JCountry[i] == str){ soption = JCity[i]; st = new Option(soption,soption); document.all["DropDownList"].add(st) }
}
} </script>
<H1>Combination OF C# and JavaScript </H1><br> By Laxmikant Shrotri <Form name="MyForm" runat="server"> <asp:Dropdownlist id="MyDropDownList" DataValueField = "CountryCode" DataTextField = "Country" runat="server" /> <asp:Dropdownlist id="DropDownList" DataValueField = "CountryCode" DataTextField = "Country" runat="server" />
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
More ASP.NET Articles More By aspfree developerWorks - FREE Tools! | Building a software-as-a-service solution requires addressing a few key technical challenges. In this webcast, we'll focus on the role of IBM Tivoli Directory Server and WebSphere Portlet Factory in creating a Software as a Service solution. We will demonstrate how to use Tivoli Directory Server to prevent the user population of one tenant from accessing the virtual portal and portlet components of another tenant. We will also use the dynamic profile capability of WebSphere Portlet Factory to create multiple highly customized applications from one code base. FREE! Go There Now!
| | | | You probably have thousands of lines of COBOL code loaded with business intelligence and being used to run your business, along with an army of developers maintaining these applications. Learn how to prepare your applications and developers so you can keep that competitive edge and move to a service-oriented architecture with the IBM Rational Enterprise Modernization solutions. Replay is available for 9 months. FREE! Go There Now!
| | | | Secure your Web applications with IBM Rational AppScan Standard Edition V7.7, previously known as Watchfire AppScan. This Web application security testing tool automates vulnerability assessments and scans and tests for common Web application vulnerabilities. Visit IBM developerWorks to download a free trial of IBM Rational AppScan Standard Edition V7.7. FREE! Go There Now!
| | | | Learn how Rational Build Forge can extend a simple compile and package build process by adding customization and deployment capability. Go from a manual method to automating: checking for code changes; getting the latest source; compiling and packaging; customizing; copying to and restarting a deployment server; and sending e-mail notification that a new version is available. FREE! Go There Now!
| | | | Learn how to do more with your reusable assets with the free Rational Asset Manager eKit. The eKit includes demos on how Rational Asset Manager tracks and audits your assets in order to utilize them for reuse. Plus you’ll find white papers and a Webcast that discuss the challenges of a Service Oriented Architecture and how Rational Asset Manager can provide quick and effective solutions. FREE! Go There Now!
| | | | Rational Build Forge Express Edition is an automation framework that packages the latest enterprise-grade technologies into a reliable, flexible and robust configuration designed and priced specifically for small to midsize businesses. The new Rational Build Forge Express eKit provides you with valuable resources – including a case study, podcast, demo, and articles – to help you increase staff productivity, compress development cycles and deliver better software, fast. FREE! Go There Now!
| | | | Learn the basics of the IBM Customer Information Control System (CICS). With a hands-on exercise, learn how to get your first CICS application up and running on your desktop using TXSeries V6.1 for Windows. The tutorial shows you how to download and install a free trial version of TXSeries V6.1. FREE! Go There Now!
| | | | This whitepaper provides areas to consider when evaluating any software configuration management solution. It addresses how the IBM solutions (Rational ClearCase and Rational ClearQuest) meet the needs and requirements of both project leaders and developers to provide successful Software Change and Configuration Management. FREE! Go There Now!
| | | | As organizations have grown increasingly dependent on online software, the risk of malicious attacks has also become far more serious. Fortunately, well-governed organizations can protect their Web applications by injecting vulnerability assessments and ethical hacks into their software development and delivery processes. This paper describes 12 of the most common hacker attacks and provides basic rules that you can follow to help create more hack-resistant Web applications. FREE! Go There Now!
| | | | Visit IBM developerWorks to try the IBM SOA Sandbox for people. The SOA Sandbox for people provides a trial environment with the necessary tooling and components required to enable consistent human and process interaction and collaboration, showing how you can improve user experience and business productivity. FREE! Go There Now!
| | | | All FREE IBM® developerWorks Tools! | |