日期:2014-05-18 浏览次数:20645 次
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestForm.aspx.cs" Inherits="WebAppTester.TestForm" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>测试页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ListBox ID="lstTest" Rows="16" runat="server" />
</div>
</form>
</body>
</html>
using System;
using System.Web.UI;
namespace WebAppTester
{
public partial class TestForm : Page
{
protected void Page_Load(object sender, EventArgs e)
{
lstTest.DataSource = Enum.GetNames(typeof(ConsoleColor));
lstTest.SelectedIndex = 4;
lstTest.DataBind();
lstTest.Enabled = false;
}
}
}
<asp:ListBox ID="ListBox1" runat="server" Enabled=false Width="126px">
<asp:ListItem Value="sss"></asp:ListItem>
<asp:ListItem Value="sss"></asp:ListItem>
<asp:ListItem Value="sssff"></asp:ListItem>
<asp:ListItem></asp:ListItem>
</asp:ListBox>
可以,
你把
lstTest.DataSource = Enum.GetNames(typeof(ConsoleColor));
lstTest.SelectedIndex = 4;
lstTest.DataBind();
换成遍历添加试试。
------解决方案--------------------
试试纯 HTML的多选菜单 如果还不行说明你的机子浏览器有问题!
<select name="selectlist" size="23" disabled="disabled" multiple> <option>123</option> <option>123</option> <option>123</option> <option>123</option> </select>
------解决方案--------------------
这个应该没问题啊。。。
4.0也不会有问题。。ListBox最后生成出来就是个SELECT标签而己
你用JS设置它的disabled="disabled"看看
------解决方案--------------------
<asp:ListBox ID="ListBox1" disabled="disabled" runat="server" >
<asp:ListItem >aaaa</asp:ListItem>
<asp:ListItem >bbbb</asp:ListItem>
</asp:ListBox>
------解决方案--------------------