<html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title>Untitled Page</title> <script type="text/javascript"> function test() { var index=document.getElementById("DropDownList1").Selectedindex; switch(index) { case 1: alert("client1"); break; case 2: alert("client2"); break; default: } } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:DropDownList ID="DropDownList1" runat="server"> <asp:ListItem>client1</asp:ListItem> <asp:ListItem>client2</asp:ListItem> </asp:DropDownList> empid<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> </div> </form> </body> </html>
protected void Page_Load(object sender, EventArgs e) { TextBox1.Attributes.Add("onkeypress", "javascript:test()"); }
ListBox1.Attributes.Add("onchange", "javascript::test();")
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)