/// <summary> /// 数据绑定到表格 /// </summary> protected void RolesLists_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow)//判定当前的行是否属于datarow类型的行 { RedGlovePermission.BLL.RGP_Groups Groupbll = new RedGlovePermission.BLL.RGP_Groups(); DataSet Groups1 = Groupbll.GetGroupList("", "order by GroupOrder asc"); //当鼠标放上去的时候 先保存当前行的背景颜色 并给附一颜色 e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#ffffcd',this.style.fontWeight='';"); //当鼠标离开的时候 将背景颜色还原的以前的颜色 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor,this.style.fontWeight='';"); LinkButton btnDel = ((LinkButton)e.Row.FindControl("btn_del")); Label Lab_GroupID = ((Label)e.Row.FindControl("Lab_GroupID")); Label hid_GroupID = ((Label)e.Row.FindControl("hid_GroupID")); for (int i = 0; i < Groups1.Tables[0].Rows.Count; i++) { if (Groups1.Tables[0].Rows[i]["GroupID"].ToString() == hid_GroupID.Text) { Lab_GroupID.Text = ResourceManager.GetString(Groups1.Tables[0].Rows[i]["GroupName"].ToString()); } } btnDel.Attributes.Add("onclick", "return confirm('" + ResourceManager.GetString("Pub_Msg_confirm") + "')"); } if ((e.Row.RowState & DataControlRowState.Edit) != 0) { RedGlovePermission.BLL.RGP_Groups Groupbll = new RedGlovePermission.BLL.RGP_Groups(); DataSet Groups2 = Groupbll.GetGroupList("", "order by GroupOrder asc"); Label hid_GroupID = ((Label)e.Row.FindControl("hid_GroupID")); DropDownList GroupID = ((DropDownList)e.Row.FindControl("GroupID")); for (int i = 0; i < Groups2.Tables[0].Rows.Count; i++) { string s = Groups2.Tables[0].Rows[i]["GroupName"].ToString(); if (ResourceManager.GetString(s) != "") { GroupID.Items.Add(new ListItem(ResourceManager.GetString(s), Groups2.Tables[0].Rows[i]["GroupID"].ToString())); } else { GroupID.Items.Add(new ListItem(s, Groups2.Tables[0].Rows[i]["GroupID"].ToString())); } } GroupID.SelectedValue = hid_GroupID.Text; } }
/// <summary> /// 将数据绑定到DataSet /// </summary> public void BindOrder() { DataSet ds = bll.GetGroupList("", "order by GroupOrder asc"); if (ds.Tables[0].Rows.Count == 0) { GridViewMsg.InnerText = ResourceManager.GetString("Pub_Msg_norecord"); } else { GridViewMsg.InnerText = ResourceManager.GetString("Pub_Lab_gy") + ds.Tables[0].Rows.Count + ResourceManager.GetString("Pub_Lab_tjl"); } GroupsLists.DataSource = ds; GroupsLists.DataBind(); }
/// <summary> /// 绑定分组数据 /// </summary> protected void BindGroups() { RedGlovePermission.BLL.RGP_Groups Groupbll = new RedGlovePermission.BLL.RGP_Groups(); DataSet ds = Groupbll.GetGroupList("", "order by GroupOrder asc"); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string s = ds.Tables[0].Rows[i]["GroupName"].ToString(); if (ResourceManager.GetString(s) != "") { GroupList.Items.Add(new ListItem(ResourceManager.GetString(s), ds.Tables[0].Rows[i]["GroupID"].ToString())); } else { GroupList.Items.Add(new ListItem(s, ds.Tables[0].Rows[i]["GroupID"].ToString())); } } }
protected void Page_Load(object sender, EventArgs e) { if (!SessionBox.CheckUserSession()) { Response.Redirect("~/Admin/Login.aspx"); } else { //初始化模块权限 UserHandle.InitModule("Mod_Roles"); if (!UserHandle.ValidationHandle("RGP_BROWSE")) { Response.Redirect("~/Admin/Frameset/NoRight.aspx"); } if (!IsPostBack) { btn_add.Attributes.Add("onclick", "return CheckAdd()");//加入验证 #region 语言加入 btn_add.Text = ResourceManager.GetString("Pub_Btn_add"); //绑定组信息 RedGlovePermission.BLL.RGP_Groups Groupbll = new RedGlovePermission.BLL.RGP_Groups(); DataSet groupds = Groupbll.GetGroupList("", "order by GroupOrder asc"); for (int i = 0; i < groupds.Tables[0].Rows.Count; i++) { string s = groupds.Tables[0].Rows[i]["GroupName"].ToString(); if (ResourceManager.GetString(s) != "") { GroupList.Items.Add(new ListItem(ResourceManager.GetString(s),groupds.Tables[0].Rows[i]["GroupID"].ToString())); } else { GroupList.Items.Add(new ListItem(s, groupds.Tables[0].Rows[i]["GroupID"].ToString())); } } #endregion BindOrder(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!SessionBox.CheckUserSession()) { Response.Redirect("~/Admin/Login.aspx"); } else { //初始化模块权限 UserHandle.InitModule("Mod_Roles"); if (!IsPostBack) { btn_add.Attributes.Add("onclick", "return CheckAdd()");//加入验证 #region 语言加入 btn_add.Text = ResourceManager.GetString("Pub_Btn_add"); //绑定组信息 RedGlovePermission.BLL.RGP_Groups Groupbll = new RedGlovePermission.BLL.RGP_Groups(); DataSet groupds = Groupbll.GetGroupList("", "order by GroupOrder asc"); for (int i = 0; i < groupds.Tables[0].Rows.Count; i++) { string s = groupds.Tables[0].Rows[i]["GroupName"].ToString(); if (ResourceManager.GetString(s) != "") { GroupList.Items.Add(new ListItem(ResourceManager.GetString(s), groupds.Tables[0].Rows[i]["GroupID"].ToString())); } else { GroupList.Items.Add(new ListItem(s, groupds.Tables[0].Rows[i]["GroupID"].ToString())); } } #endregion BindOrder(); } } }