#region dropListRoleId绑定数据
/// <summary>
/// dropListRoleId绑定父级下拉列表
/// </summary>
private void Bind_dropListRoleId()
{
this.dropListRoleId.Properties.ValueMember = "id";
this.dropListRoleId.Properties.DisplayMember = "RoleName";
this.dropListRoleId.Properties.DataSource = BindData_RoleId();
}
/// <summary>
/// RoleId绑定的数据表头列
/// </summary>
/// <returns></returns>
private DataTable Column_RoleId()
{
DataTable table1 = new DataTable();
table1.Columns.Add("id", Type.GetType("System.Int32"));
table1.Columns.Add("RoleName", Type.GetType("System.String"));
return table1;
}
/// <summary>
/// RoleId绑定数据
/// </summary>
/// <returns></returns>
private DataTable BindData_RoleId()
{
BLL.Admin_ManagerRole bll = new BLL.Admin_ManagerRole();
DataTable theTable = bll.GetList("").Tables[0];
//新表
DataTable newTable = Column_RoleId();
//添加无父级记录
DataRow newRow0 = newTable.NewRow();
newRow0["id"] = 0;
newRow0["RoleName"] = "";
newTable.Rows.Add(newRow0);
for (int i = 0; i < theTable.Rows.Count; i++)
{
DataRow newRow = newTable.NewRow();
newRow["id"] = theTable.Rows[i]["id"];
newRow["RoleName"] = theTable.Rows[i]["Name"];
newTable.Rows.Add(newRow);
}
return newTable;
}
/// <summary>
/// dropListRoleId绑定父级下拉列表
/// </summary>
private void Bind_dropListRoleId()
{
this.dropListRoleId.Properties.ValueMember = "id";
this.dropListRoleId.Properties.DisplayMember = "RoleName";
this.dropListRoleId.Properties.DataSource = BindData_RoleId();
}
/// <summary>
/// RoleId绑定的数据表头列
/// </summary>
/// <returns></returns>
private DataTable Column_RoleId()
{
DataTable table1 = new DataTable();
table1.Columns.Add("id", Type.GetType("System.Int32"));
table1.Columns.Add("RoleName", Type.GetType("System.String"));
return table1;
}
/// <summary>
/// RoleId绑定数据
/// </summary>
/// <returns></returns>
private DataTable BindData_RoleId()
{
BLL.Admin_ManagerRole bll = new BLL.Admin_ManagerRole();
DataTable theTable = bll.GetList("").Tables[0];
//新表
DataTable newTable = Column_RoleId();
//添加无父级记录
DataRow newRow0 = newTable.NewRow();
newRow0["id"] = 0;
newRow0["RoleName"] = "";
newTable.Rows.Add(newRow0);
for (int i = 0; i < theTable.Rows.Count; i++)
{
DataRow newRow = newTable.NewRow();
newRow["id"] = theTable.Rows[i]["id"];
newRow["RoleName"] = theTable.Rows[i]["Name"];
newTable.Rows.Add(newRow);
}
return newTable;
}
#endregion
this.dropListRoleId.Properties.ValueMember = "id";//提交值
this.dropListRoleId.Properties.DisplayMember = "RoleName";//显示值