hi,
can we create a drop down list by using a "button" ,instead of using menu strip.By using menu control we can add items into it.
but I want to know that is possible to create dropdownlist to a button.
if anyone know.pls reply.
regards
srinivas
hi,
can we create a drop down list by using a "button" ,instead of using menu strip.By using menu control we can add items into it.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Amit Kumar SinghRank #562 · 4.3K reputationPosted Feb 16, 2016, 6:47 PM EST
Chandu KumawatRank #1,449 · 1.1K reputationPosted Feb 16, 2016, 7:12 PM EST
Michael GriffithsRank #1,251 · 1.4K reputationPosted Feb 17, 2016, 1:46 AM EST
Hi there.
You can do this by creating your menu, set its display to none then on the client side onclick event you can change display from none to block. I would also suggest absolutely positioning your hidden menu so you can set its z-index to a higher number so it will sit on top of the page rather than pushing all of your content down
!DOCTYPE html> html lang="en" xmlns="http://www.w3.org/1999/xhtml"> head> meta charset="utf-8" /> title>Drop down menu on button clicktitle> style type="text/css"> #menu { position:absolute; top:50px; z-index:50; width:100%; background:#808080; color: #ffffff; } .menu1 { display:none; } .menu2 { display:block; } style> head> body> button id="btnMenu" onclick="buttonclick();" >Click me!button> ul id="menu" class="menu1"> li>Item 1li> li>Item 2li> li>Item 3li> ul> hr /> script type="text/javascript"> function buttonclick() { var menuList = document.getElementById("menu"); if (menuList.className == "menu1") { menuList.className = "menu2"; } else { menuList.className = "menu1"; } } script> body> html>