标签:style blog http io ar color os sp for
1.权限以menu表为准为动态
/// <summary> /// 画面数据绑定 /// </summary> protected void Bind() { try { LOG.Debug("[Bind]执行开始。"); string strRoleKey = ""; string strRoleName = ""; string strMenuIds = ""; string[] MenuId; Sys_MenuBusiness bllSysMenu = new Sys_MenuBusiness(); DataSet menuDs = new DataSet(); menuDs = bllSysMenu.GetMenuList(); for (int countRow = 0; countRow < menuDs.Tables[0].Rows.Count; countRow++) { TableRow row = new TableRow(); //label TableCell cell1; cell1 = new TableCell(); Label lblMenuName = new Label(); lblMenuName.ID = "lblMenuName" + countRow.ToString(); lblMenuName.Attributes.Add( "Name","lblMenuName" + countRow.ToString()); lblMenuName.Text = menuDs.Tables[0].Rows[countRow]["MenuName"].ToString(); lblMenuName.Font.Size = 9; cell1.Controls.Add(lblMenuName); row.Cells.Add(cell1); //checkbox TableCell cell2; cell2 = new TableCell(); CheckBox cbxMenuName = new CheckBox(); cbxMenuName.ID = "cbxMenuName" + menuDs.Tables[0].Rows[countRow]["MenuId"].ToString(); //模式为更新,绑定当前角色权限数据 if (model != "0") { //获取更新RoleKey string RoleKey = ""; if (Request.QueryString["RoleKey"] != null) { RoleKey = Request.QueryString["RoleKey"].ToString(); } //获取更新RoleKey数据 Sys_RoleBusiness bll = new Sys_RoleBusiness(); DataSet ds = new DataSet(); ds = bll.GetKeyRoleList(RoleKey); strRoleKey = ds.Tables[0].Rows[0]["RoleKey"].ToString(); strRoleName = ds.Tables[0].Rows[0]["RoleName"].ToString(); strMenuIds = ds.Tables[0].Rows[0]["MenuIds"].ToString(); if (ds.Tables[0].Rows[0]["IsActivity"].ToString().ToUpper() == "TRUE") { ddlIsActivity.SelectedValue = "1"; } else { ddlIsActivity.SelectedValue = "0"; } MenuId = strMenuIds.Split(‘,‘); hidRoleKey.Value = strRoleKey; txtRoleName.Text = strRoleName; for (int count = 0; count < MenuId.Length; count++) { if (menuDs.Tables[0].Rows[countRow]["MenuId"].ToString() == MenuId[count]) { cbxMenuName.Checked = true; break; } } } cell2.Controls.Add(cbxMenuName); row.Cells.Add(cell2); tbMenuIds.Rows.Add(row); } LOG.Debug("[Bind]执行结束。"); } catch (Exception ex) { LOG.Error(ex.Message); } }
2.弹出子画面时候需要禁用父页面,选用showModalDialog()
问题一:子画面更新后关闭window.opener=null;window.close();无提示框弹出,会弹出一个新的页面。
解决方案:在head标签中追加<base target="_self"/>
问题二:子画面二次进入时保存在缓存中,不走pageload,导致数据更新后没有重新绑定动态checkbox。
解决方案:Response.Expires = -1; 给一个过期时间,重新刷新页面。
问题三:子画面DB更新后页面关闭,父页面无刷新保持旧数据。
解决过程1:window.location.reload(); 会刷新整个页面,有如下提示。
解决过程2:window.location.href = window.location.href; IE完成刷新父页面,但是火狐不兼容,弹不出showModalDialog。
解决过程3:window.location.replace(url);完成火狐和IE的父页面刷新。
3.更新获取前台动态checkbox,checked的ID(数字部分对应的menuID)拼接字符串逗号隔开
string strMenuIds = ""; Sys_MenuBusiness bll = new Sys_MenuBusiness(); DataSet menuDs = new DataSet(); menuDs = bll.GetMenuList(); for (int count = 0; count < menuDs.Tables[0].Rows.Count; count++) { string check = Request.Form["cbxMenuName" + menuDs.Tables[0].Rows[count]["MenuId"].ToString()]; if (check == "on") { strMenuIds = strMenuIds + menuDs.Tables[0].Rows[count]["MenuId"].ToString() + ","; } }
标签:style blog http io ar color os sp for
原文地址:http://www.cnblogs.com/yuangel/p/4159334.html