protected string jsMessage; // js处理提示信息 #endregion #region Page_Load protected void Page_Load(object sender, EventArgs e) { commonFieldGroup = new KingTop.BLL.Content.ModelcommonFieldGroup(); if (!IsPostBack) { PageInit(); } }
void PageInit() { DataTable dataTableField; BLL.Content.ModelcommonFieldGroup commonFieldGroup; bool isValidate; bool isAdd; commonFieldGroup = new KingTop.BLL.Content.ModelcommonFieldGroup(); dataTableField = commonFieldGroup.GetList("LIST", new KingTop.Model.SelectParams()); // 分组绑定 ddlGroupID.DataTextField = "NAME"; ddlGroupID.DataValueField = "ID"; ddlGroupID.DataSource = dataTableField; ddlGroupID.DataBind(); ddlGroupID.Items.Insert(0, new ListItem("-----请选择分组-----", "")); commonField.ValidationTypeBind(radlValidationType); // 绑定验证规则 dataTableField = commonField.DropDownDataTypeBind(ddlDropDownTable, null); // 绑定数据表 ddlDropDownTextColumn.DataTextField = "Name"; // 绑定Text列 ddlDropDownTextColumn.DataValueField = "Name"; ddlDropDownTextColumn.DataSource = dataTableField; ddlDropDownTextColumn.DataBind(); ddlDropDownValueColumn.DataTextField = "Name"; // 绑定Value列 ddlDropDownValueColumn.DataValueField = "Name"; ddlDropDownValueColumn.DataSource = dataTableField; ddlDropDownValueColumn.DataBind(); isAdd = true; if (this.Action.ToLower() == "edit") { isAdd = false; isValidate = IsHaveRightByOperCode("Edit"); // 修改权限认证 if (!isValidate) { jsMessage = "errmsg=\"对不起,您没有修改模型的操作权限,请与管理员联系!\";id=\"" + ID + "\""; } } else { isValidate = IsHaveRightByOperCode("New"); // 添加权限认证 if (!isValidate) { jsMessage = "errmsg=\"对不起,您没有添加模型的操作权限,请与管理员联系!\";id=\"" + ID + "\""; } } if (!isAdd) // 编辑 { DataTable dtField; KingTop.Model.SelectParams selParam; selParam = new KingTop.Model.SelectParams(); selParam.S1 = ID; hdnAction.Value = "edit"; btnModelField.Text = "修改"; dtField = commonField.GetList("ONE", selParam); if (dtField != null && dtField.Rows.Count > 0) { ddlGroupID.SelectedValue = dtField.Rows[0]["CommonFieldGroupID"].ToString().Trim(); hdnBasicField.Value = dtField.Rows[0]["BasicField"].ToString().Trim(); BasicFieldInit(dtField.Rows[0]); CommonFieldInit(dtField.Rows[0]); } else { jsMessage = "errmsg=\"对不起,参数传递有误。\";id=\"" + ID + "\""; } } else // 添加 { hdnAction.Value = "add"; } }