Click here to Skip to main content
15,911,306 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi..

I have a textbox on my web page. The moment user clicks on it should replace by a Dropdown List control at the same place.
I can switch visibility on or off But I don't know how to go about it.

Any suggestions please??
Posted

1 solution

Hi,

Take two controls in page. One is Textbox and another is Dropdown.
Set the css style for dropdon as below:
CSS
.DropDown{
      display:none;
}

Use this javascript coding on click of textbox:

JavaScript
function fnShowDropDwn(){
     var txt=document.getElementById("MyTextBox1");
     txt.style.display='none';
     var ddl=document.getElementById("MyDropDown1");
     ddl.style.display='';
}


All the best.
--Amit
 
Share this answer
 
Comments
comred 2-Jul-12 0:42am    
Thanks...
_Amy 2-Jul-12 0:49am    
You are welcome. :)
comred 2-Jul-12 3:33am    
I am failing to call this function. Would you give some snippet that how to call java script function in my asp.net page...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900