private void Page_Load(object sender, System.EventArgs e) { RoleID = (Request.QueryString["Role_ID"] == null)?0:Int32.Parse(Request.QueryString["Role_ID"].ToString()); DisplayType = Int32.Parse((Request.QueryString["DisplayType"] == null)?"0":Request.QueryString["DisplayType"].ToString()); if (!Page.IsPostBack) { txtMRoleName.Text = ""; SqlDataReader dr; UDS.Components.Role myRole = new UDS.Components.Role(); dr = myRole.GetRoleInfo(RoleID); while (dr.Read()) { RoleName = dr["Role_Name"].ToString(); RoleDescription = dr["Role_Description"].ToString(); } dr.Close(); dr = null; myRole = null; } // 显示不同表格 if (DisplayType == 0) { tabAdd.Visible = true; tabDelete.Visible = false; tabModify.Visible = false; tabAdd.Style["left"] = "0px"; tabAdd.Style["top"] = "100px"; } else if (DisplayType == 1) { tabAdd.Visible = false; tabDelete.Visible = true; tabModify.Visible = false; tabDelete.Style["left"] = "0px"; tabDelete.Style["top"] = "100px"; delRoleName.Text = RoleName; } else if (DisplayType == 2) { tabAdd.Visible = false; tabDelete.Visible = false; tabModify.Visible = true; tabModify.Style["left"] = "0px"; tabModify.Style["top"] = "100px"; if (txtMRoleName.Text.Trim() == "") { txtMRoleName.Text = RoleName; txtMRoleDescription.Text = RoleDescription; } } }
private void Page_Load(object sender, System.EventArgs e) { RoleID=(Request.QueryString["Role_ID"]==null)?0:Int32.Parse(Request.QueryString["Role_ID"].ToString()); DisplayType = Int32.Parse((Request.QueryString["DisplayType"]==null)?"0":Request.QueryString["DisplayType"].ToString()); if(!Page.IsPostBack) { txtMRoleName.Text = ""; SqlDataReader dr; UDS.Components.Role myRole = new UDS.Components.Role(); dr = myRole.GetRoleInfo(RoleID); try { while (dr.Read()) { RoleName = dr["Role_Name"].ToString(); RoleDescription = dr["Role_Description"].ToString(); } } finally { if (dr != null) { dr.Close(); } } dr = null; myRole = null; } // ��ʾ��ͬ��� if(DisplayType == 0) { tabAdd.Visible = true; tabDelete.Visible = false; tabModify.Visible = false; tabAdd.Style["left"] = "0px"; tabAdd.Style["top"] = "100px"; } else if(DisplayType==1) { tabAdd.Visible = false; tabDelete.Visible = true; tabModify.Visible = false; tabDelete.Style["left"] = "0px"; tabDelete.Style["top"] = "100px"; delRoleName.Text = RoleName; } else if(DisplayType==2) { tabAdd.Visible = false; tabDelete.Visible = false; tabModify.Visible = true; tabModify.Style["left"] = "0px"; tabModify.Style["top"] = "100px"; if(txtMRoleName.Text.Trim() == "") { txtMRoleName.Text = RoleName; txtMRoleDescription.Text = RoleDescription; } } }