我有一個15datatypes下拉列表,當我點擊下拉它看起來如此笨拙,u能建議我如何把滾動下拉列表中在asp.net 下拉列表應該顯示6項僅剩下上滾動
-1
A
回答
0
這裏TextBox將保存列表框的選定值。下面我的ASPX代碼:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text="Select your item" CssClass="MyTextBox"></asp:TextBox>
<div style="padding: 4px;" id="ItemsDiv" runat="server">
<asp:ListBox ID="ListBox1" runat="server" onclick="callme()" CssClass="MyDropDown" Rows="6">
</asp:ListBox>
</div>
<asp:DropDownExtender ID="DropDownExtender1" runat="server" TargetControlID="TextBox1"
DropDownControlID="ItemsDiv">
</asp:DropDownExtender>
</ContentTemplate>
</asp:UpdatePanel>
<script>
function callme() {
element = document.getElementById("ListBox1");
str = element.options[element.selectedIndex].value;
document.getElementById("TextBox1").value = str;
}
</script>
否則請點擊此鏈接:
或http://forums.asp.net/t/1905270.aspx?DropDownList+Scroll+Bars
0
嘗試使用下面的代碼。
<asp:DropDownList runat="server" ID="ddlColors" onmousedown="this.size=5;" >
<asp:ListItem>Red</asp:ListItem>
<asp:ListItem>Green</asp:ListItem>
<asp:ListItem>Blue</asp:ListItem>
<asp:ListItem>Yellow</asp:ListItem>
<asp:ListItem>White</asp:ListItem>
<asp:ListItem>Black</asp:ListItem>
<asp:ListItem>Purple</asp:ListItem>
<asp:ListItem>no color</asp:ListItem>
</asp:DropDownList>
或者你可以在下拉菜單中使用CSS的overflow屬性和height屬性來添加一個滾動條。
.dropmenudiv
{
height: 300px;
max-height: 300px;
overflow-y: scroll;
}
1
我想你想要這樣的:
<asp:DropDownList ID="ddl" width="100px" onclick="this.size=1;" onMouseOver="this.size=5;" onMouseOut="this.size=1;" style="position:absolute;" runat="server">
<asp:ListItem>TextTextText1</asp:ListItem>
<asp:ListItem>TextTextText2</asp:ListItem>
<asp:ListItem>TextTextText3</asp:ListItem>
<asp:ListItem>TextTextText4</asp:ListItem>
<asp:ListItem>TextTextText5</asp:ListItem>
<asp:ListItem>TextTextText6</asp:ListItem>
<asp:ListItem>TextTextText7</asp:ListItem>
<asp:ListItem>TextTextText8</asp:ListItem>
<asp:ListItem>TextTextText9</asp:ListItem>
<asp:ListItem>TextTextText10</asp:ListItem>
<asp:ListItem>TextTextText11</asp:ListItem>
</asp:DropDownList>
+0
IT正在工作,但問題與此\t \t 在列表視圖中我有一個下拉列它不在列表視圖中調整 – Karthik
相關問題
- 1. MFC組合框下拉/下拉列表:僅顯示一個項目
- 2. 僅顯示HTML下拉列表中的一些選項
- 3. 下拉列表不顯示
- 4. 下拉列表,顯示
- 5. 下拉列表不顯示
- 6. 顯示下拉列表
- 7. 反覆顯示動態下拉列表
- 8. 如何動態顯示下拉列表
- 9. 點擊iphone移動箭頭鍵時到達下拉列表,它應該顯示下拉列表內容
- 10. 滾動條未顯示在Chrome中的下拉列表中
- 11. javascript在下拉列表中顯示垂直滾動條
- 12. bootstrap-dropdown不顯示其應該在哪裏的下拉列表
- 13. 當點擊下拉菜單中的項目應該顯示在儀表盤,並從下拉列表中
- 14. 防止在SWT中的Windows上滾動下拉列表選項
- 15. 下拉列表項
- 16. 在jgrid上顯示下拉列表框選項
- 17. MVC 5 EF 6 EditorFor下拉列表更改顯示文本
- 18. 下拉列表中的滾動條
- 19. Asp.net下拉列表可滾動
- 20. 可滾動的下拉列表
- 21. 焦點上的顯示下拉選項
- 22. 下拉浮動值不顯示選項
- 23. 單擊ListView項目時顯示下拉PopupWindow,然後滾動ListView?
- 24. IE 6下拉的WordPress的不顯示
- 25. 我的下拉選項顯示按鈕時,它不應該
- 26. android autocompletetextview應該只顯示下拉相關的選項
- 27. 單元格中的UILabel僅在滾動上下後顯示
- 28. 第二個下拉選擇列表僅顯示爲文本
- 29. ShieldUI Grid - 僅在插入時顯示下拉列表
- 30. SSRS列項下拉列表
你有什麼到目前爲止已經試過? – Sachin
[隱藏垂直滾動條在
爲什麼不使用'size = 10'而不是下拉菜單? – Abhitalks