试试清空后再重新绑定?反正refresh也是要刷新的

解决方案 »

  1.   

    就按常规写没任何问题的啊.绑定一个新的数据源后就OK的.
    我的代码是:
    <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">
    <FONT face="宋体">
    <asp:ListBox id="ListBox1" style="Z-INDEX: 101; LEFT: 32px; POSITION: absolute; TOP: 24px" runat="server"
    Width="160px" Height="128px" AutoPostBack="True"></asp:ListBox></FONT>
    </form>
    </body>
    private void Page_Load(object sender, System.EventArgs e)
    {
    // 在此处放置用户代码以初始化页面
    if (!Page.IsPostBack)
    {
    ArrayList objList = new ArrayList();
    objList.Add("中国北京");
    objList.Add("美国华盛顿");
    objList.Add("英国伦敦");
    objList.Add("法国巴黎");
    objList.Add("意大利罗马");
    objList.Add("中国西安"); this.ListBox1.DataSource = objList;
    this.ListBox1.DataBind();
    }
    给ListBox添加SelectIndexChanged事件.然后写代码:
    private void ListBox1_SelectedIndexChanged(object sender, System.EventArgs e)
    {
    ArrayList objList = new ArrayList();
    objList.Add("香港");
    objList.Add("澳门");
    objList.Add("衙门");
    objList.Add("台湾");
    objList.Add("厦门");
    this.ListBox1.DataSource = objList;
    this.ListBox1.DataBind();
    }
    运行没有任何问题的!