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! | Join this webcast, to learn how the Rational Process Library can help with compliance issues, drive process improvement, and assist in service-oriented architecture (SOA) or Agile development. We will take a peek into the Rational Process Library with content around software and systems engineering (including RUP), operations and systems management, program and portfolio management, and asset and SOA governance. FREE! Go There Now!
| | | | David Barnes, Lead Evangelist for IBM Emerging Internet Technologies will discuss aspects of Web 2.0 that bring value to corporations, academia, and government. He'll also discuss IBM's vision around Web 2.0, including the importance of remixability and consumability. The discussion will culminate with examples of various IBM Software Group solutions you can use to get ahead of the Web 2.0 adoption curve. FREE! Go There Now!
| | | | As businesses grow increasingly dependent upon Web applications to provide services to customers, employees and partners, these complex applications become more difficult to secure. Although traditional security solutions protect Internet infrastructure layers, they do not guard against HTTP and HTML attacks. Many organizations that conduct security testing still deploy applications that allow attackers to manipulate their logic and wreak havoc on their business. To mitigate this risk, development and delivery teams must address Web application security throughout the lifecycle, addressing the many layers detailed in this paper. FREE! Go There Now!
| | | | This whitepaper presents the benefits of successfully introducing static analysis into your organization using IBM Rational Software Analyzer. Additionally, it identifies some common pitfalls that can hinder the effective use of static analysis tooling as well as presents 10 simple strategies designed to help you quickly realize the value of static analysis using Rational Software Analyzer. FREE! Go There Now!
| | | | CakePHP is a stable production-ready, rapid-development aid for building Web sites in PHP. This "Cook up Web sites fast with CakePHP" series shows you how to build an online product catalog using CakePHP. FREE! Go There Now!
| | | | Download a free trial version of IBM Rational Developer for System i V7.1, which provides a complete development environment for traditional i5/OS application development. IBM Rational Developer for System i is a new eclipse-based workstation offering for i5/OS application development that provides a comprehensive Integrated Development Environment for edit/compile/debug of traditional RPG/COBOL/C/C++ i5/OS applications. FREE! Go There Now!
| | | | This tutorial shows new users of IBM WebSphere Business Monitor Version 6.0.2 how to perform the "Hello World" equivalent for monitoring business process applications. It is intended to help you get familiar with the capabilities of the product. FREE! Go There Now!
| | | | Manage, govern, and share services across your organization by using WebSphere Service Registry and Repository. Follow the hands-on exercises to learn how to navigate the Web interface to publish, find, reuse, and update services. FREE! Go There Now!
| | | | As systems increase in complexity, communication between systems and software teams becomes more and more difficult. Now, there’s a way to improve product quality and communication.<br />Read the “Model Driven Systems Development” white paper to see how. Also included in this kit are more educational white papers, customer examples, tutorials, informative Webcasts, and best practices for designing, building and managing systems.<br /> FREE! Go There Now!
| | | | Join the IBM Watchfire team for an informative discussion on techniques and best practices to proactively manage Web application security and how to effectively build application security testing into the software development lifecycle (SDLC). In this Software Delivery Platform webcast you will learn: How to better understand potential web application security vulnerabilities, best practices and how to effectively integrate application security testing into the software development lifecycle, the importance of detecting and removing software vulnerabilities during application development. FREE! Go There Now!
| | | | All FREE IBM® developerWorks Tools! | |