asp.netlistbox 단일 선택 모두 취소

5760 단어
무대
 
  






<br>function Ok() <br>{ <br>window.close(); <br>opener.document.all.txtOtherMan.value = window.Form2.hide.value; <br>} <br>function Cancel() <br>{ <br>window.close(); <br>} <br>














--%>













백그라운드
 
  
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BLL;
using Model;
public partial class Boarding_HarmSelRoleEmp : System.Web.UI.Page
{
protected void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{

if (BLL.EmailUser.GetEmailUserByID(Session["username"].ToString()).userCompany.ToString() == " ")//

{

// listbox
this.UserList.Items.Clear();
this.UserList.Items.Add(new ListItem(" ", " "));
this.UserList.Items.Add(new ListItem(" ", " "));
this.UserList.Items.Add(new ListItem(" ", " "));
this.UserList.Items.Add(new ListItem(" ", " "));
this.UserList.Items.Add(new ListItem("IT", "IT"));
}

}
}
protected void cmdAdd_Click(object sender, System.EventArgs e)//
{
bool exist=false;// ,
foreach( ListItem li in lstSelEmp.Items)
{
if(li.Value==UserList.SelectedItem.Value)
{
exist=true;
}
}
if(exist==false)
{
lstSelEmp.Items.Add(new ListItem(UserList.SelectedItem.Text,UserList.SelectedItem.Value));
}
}
protected void cmdDel_Click(object sender, System.EventArgs e)//
{
lstSelEmp.Items.Remove(lstSelEmp.SelectedItem);
}
protected void cmdDelAll_Click(object sender, System.EventArgs e)//
{
for(int i=0;ilstSelEmp.Items.Remove(lstSelEmp.Items[i]);
}
protected void cmdAddAll_Click(object sender, System.EventArgs e)//
{
foreach(ListItem li in UserList.Items)
{
bool exist=false;
foreach( ListItem lised in lstSelEmp.Items)
if(lised.Value==li.Value)
exist=true;
if(exist==false)
lstSelEmp.Items.Add(new ListItem(li.Text,li.Value));
}
}
public string pass()
{
string txt="";
for(int j=0;j < lstSelEmp.Items.Count;j++)
{
txt+=lstSelEmp.Items[j];
txt+="','";
}
return txt;
}
}

좋은 웹페이지 즐겨찾기