Requirement in Drop down list
-
Hi Hariharan, It's good to hear that. If my script works for you, don't forget to vote my message. :) thanks. Instead of using static name "DropDownList1", you should probably pass this name as the parameter. so, it will work if you have more than one dropdown.
var selectList = document.getElementById('DropDownList1');
This variable holds only one value. maybe. you can add more variables. or you can handle this variable to hold the value depend on what the user is typing.var pressedKeyString = "";
Hope it helps.Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
Hi Michael, In the function "foo(event,id)", can you tell me what is the use of the event. See in my website I got this dropdown list in a formview insert template where it bound to the object data source. I have added your script to my master page. And the function calling is as follows, protected void FormView1_DataBound(object sender, EventArgs e) { switch (FormView1.CurrentMode) { case FormViewMode.Insert: ((DropDownList)FormView1.FindControl("DropDownList3")).Attributes.Add ("onkeypress", "javascript:return foo(event,'ctl00_ContentPlaceHolder1_FormView1_DropDownList3');"); break; } } But its not working in my page. So can you please help me on this. Dont worry Michael defenitely i am going to vote for you. Thanks in advance. Thanks and Regards, Hariharan C