ListBox.Items.Add("1");
ListBox.Items.Add("1");
ListBox.Items.Add("1");
ListBox.Items.Add("1");
ListBox.SelectedIndex = ListBox.Items.Count - 1; 
在这之后会显示到最下面的一行
但是会显示蓝条
我现在想把蓝条去掉但是不会导致滚动条滚到控件最上面
应该如何做

解决方案 »

  1.   

    你可以这样
    <%@ Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server">  protected void Page_Load(object sender, EventArgs e)
      {
        x.Items.Add("1");
        x.Items.Add("2");
        x.Items.Add("3");
        x.Items.Add("4");
        x.Items.Add("11");
        x.Items.Add("22");
        x.Items.Add("33");
        x.Items.Add("4444444444444444444444444");
      }
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
      <title></title>
      <script type="text/javascript">
        window.onload = function () {
          document.getElementById('<%=x.ClientID %>').scrollTop = document.getElementById('<%=x.ClientID %>').scrollHeight;
        }
      </script>
    </head>
    <body>
      <form id="form1" runat="server">
      <asp:ListBox ID="x" runat="server" Rows="3"></asp:ListBox>
      </form>
    </body>
    </html>
      

  2.   

    我刚刚找了下选中时我用JQUERY重写他的样式,但是蓝条我还真找不到能改的地方,能试的属性都试了下坐等高人
      

  3.   

    要不你们帮我想一个办法让ListBox默认垂直滚动条在最下面
    ListBox.SelectedIndex = ListBox.Items.Count - 1;  
    这种方法不行
    会出现蓝条