protected void VerdictList_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
RoleCollection List = new RoleCollection();
int RoleID = Convert.ToInt32(e.Item.Cells[0].Text);
RoleEntity Entity1 = List.GetRoleEntityByRoleID(RoleID);
e.Item.Cells[1].Text = Entity1.RoleName;
int RoleDptID = Convert.ToInt32(e.Item.Cells[2].Text);
DropDownList ApproverdptName = (DropDownList)(e.Item.Cells[4].FindControl("ApproverDpt"));
DptList dptlist = new DptList(RoleDptID);
ApproverdptName.DataValueField = "dptid";
ApproverdptName.DataTextField = "dptname";
ApproverdptName.DataSource = dptlist;
ApproverdptName.DataBind();
UserRoleCollection List1 = new UserRoleCollection((Convert.ToInt32(ApproverdptName.SelectedValue)), RoleID);
DropDownList ApproverList = (DropDownList)(e.Item.Cells[5].FindControl("ApproverList"));
ApproverList.DataValueField = "UserID";
ApproverList.DataTextField = "UserID";
ApproverList.DataSource = List1;
ApproverList.DataBind();
string defUser = GetDefUserID(AppID, Convert.ToInt32(e.Item.Cells[6].Text.Trim().ToString()));//默认选中用户。
ApproverList.SelectedIndex = ApproverList.Items.IndexOf(ApproverList.Items.FindByValue(defUser));
UserList List2 = new UserList(ApproverdptName.SelectedValue);
for (int i = 0; i < ApproverList.Items.Count; i++)
{
UserEntity Entity = List2.GetUserEntityByUserID(Convert.ToInt32(ApproverList.Items[i].Value));
ApproverList.Items[i].Text = Entity.UserName;
}
}
}