//Click Save Button protected void btnSave_Click(object sender, EventArgs e) { try { var entity = GetSaveEntity(); List <CRMUser> UList = new List <CRMUser>(); if (DDCLUser.SelectedValuesToString() != "") { string[] arr = DDCLUser.SelectedValuesToString().Split(','); foreach (var ID in arr) { var p = new CRMUser(); p.UserID = long.Parse(ID); UList.Add(p); } } entity = svr.Save(entity, UList); hidID.Value = entity.ACTID.ToString(); this.ShowSaveOK(); btnBack_Click(null, null); } catch (Exception ex) { this.ShowMessage(ex.Message); } }
private void BindUser() { //bind Products DDCLUser.DataSource = svr.GetUser(); DDCLUser.DataTextField = "UserName"; DDCLUser.DataValueField = "UserID"; DDCLUser.DataBind(); //bind action partispate person var Users = svr.GetJoinUsers(long.Parse(hidID.Value)); foreach (var p in Users) { foreach (ListItem item in DDCLUser.Items) { //从数据库查出绑定,或者新建时,默认选中录入人 if (item.Value == p.ACTUser.ToString() || (hidID.Value == "0" && item.Value == base.LoginUserID.ToString())) { item.Selected = true; } } } }