zoukankan      html  css  js  c++  java
  • asp.net Listbox实现双向加入、删除

    /// <summary>
            /// 添加服务器名称(可多选)
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            protected void BT_Add_Click(object sender, EventArgs e)
            {
                int selectNum = this.LST_Left.Items.Count;
                if (selectNum > 0)
                {
                    for (int i = selectNum-1; i >= 0; i--)
                    {
                        if (this.LST_Left.Items[i].Selected)
                        {
                            ListItem tmpListItem = this.LST_Left.Items[i];
                            this.LST_Right.Items.Add(tmpListItem);
                            this.LST_Left.Items.Remove(tmpListItem);
                        }
                    }
                }
               
            }

            /// <summary>
            /// 删除服务器名称(可多选)
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            protected void BT_DEL_Click(object sender, EventArgs e)
            {
                int selectNum = this.LST_Right.Items.Count;
                if (selectNum > 0)
                {
                    for (int i = selectNum - 1; i >= 0; i--)
                    {
                        if (this.LST_Right.Items[i].Selected)
                        {
                            ListItem tmpListItem = this.LST_Right.Items[i];
                            this.LST_Left.Items.Add(tmpListItem);
                            this.LST_Right.Items.Remove(tmpListItem);
                        }
                    }
                }
            }

  • 相关阅读:
    使用非ServiceDependency方法获得模块中已注册的服务
    一个比较有效的存储过程命名规则
    SQL重复记录查询
    Redis命令行启动,修改密码
    springboot+dubbo后端打包成jar并运行
    开发问题:NOAUTH Authentication required
    @Api报错
    String的indexof使用
    开发报错:init datasource error, url: jdbc:mysql://localhost:3306/book(初始化数据库错误)
    开发问题:异常Required request body is missing
  • 原文地址:https://www.cnblogs.com/MyBeN/p/2455382.html
Copyright © 2011-2022 走看看