private void BindFirstApply()
        {


            using (SPWeb web = SPControl.GetContextSite(Context).OpenWeb())
            {
              
                DataTable ownerTable = Make_Table();
                foreach (SPUser user in web.SiteUsers)
                {
                    for (int i = 0; i < user.Groups.Count; i++)
                    {
                     
                        if (user.Groups[i].ToString() == "项目经理" && user.Name.ToString() != "System Account")
                        {
                            DataRow newRow = ownerTable.NewRow();
                            newRow["Name"] = user.Name.ToString();
                            newRow["LoginName"] = user.LoginName;
                            ownerTable.Rows.Add(newRow);
                        }
                    }
                }
                DropDownListFirstApplyer.DataSource = ownerTable;
                DropDownListFirstApplyer.DataTextField = "Name";
                DropDownListFirstApplyer.DataValueField = "LoginName";
                DropDownListFirstApplyer.DataBind();

            }
        }

 


        private DataTable Make_Table()
        {
            DataTable nameTable = new DataTable("Names");
            nameTable.Columns.Add("Name");
            nameTable.Columns.Add("LoginName");

            return nameTable;
        }

相关文章:

  • 2022-02-10
  • 2022-12-23
  • 2022-12-23
  • 2018-01-11
  • 2021-11-06
  • 2022-01-10
  • 2021-10-15
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-21
  • 2022-12-23
  • 2021-12-24
  • 2022-12-23
  • 2022-12-23
  • 2022-02-17
相关资源
相似解决方案