ludy

listbox 列表框使用

                    <mb:DualList ID="DualList1" runat="server" EnableMoveAll="True" Height="300px" LeftListLabelText="输出项目"
                        MoveAllLeftButtonText="移除所有" MoveAllRightButtonText="添加所有" MoveDownButtonText="下移"
                        MoveLeftButtonText="<- 移除" MoveRightButtonText="添加 ->" MoveUpButtonText="上移"
                        RightListLabelText="选择项目" Width="400px">
                        <ButtonStyle CssClass="btnOut" />
                        <LeftListStyle Height="300px" Width="200px" />
                        <RightListStyle Height="300px" Width="200px" />
                    </mb:DualList>


//以上为页面代码

 public void BindListBox()
 {
  //设定绑定字段,绑定ListBox中共选择项
  this.DualList1.RightDataSource = dStu.GetList(string.Format(" and MajorID='{0}'and ClassID='{1}'", Request.QueryString["MID"].ToString(), Request.QueryString["CID"].ToString())).Tables[0].DefaultView;
  this.DualList1.RightDataTextField = "StuName";
  this.DualList1.RightDataValueField = "ID";


  this.DualList1.LeftDataSource = dStu.GetList("").Tables[0].DefaultView;
  this.DualList1.LeftDataTextField = "StuName";
  this.DualList1.LeftDataValueField = "ID";
  this.DualList1.DataBind();
 }
//以上为后台数据绑定代码

posted on 2008-07-11 11:25  ludy  阅读(437)  评论(0编辑  收藏  举报

导航