Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     ctrManageEdit          = new KingTop.BLL.Content.ControlManageEdit(hdnFieldValue.Value, hdnTableName.Value, hdnModelID.Value);
     ctrManageEdit.SiteID   = SiteID;
     ctrManageEdit.NodeCode = NodeCode;
     ctrManageEdit.UserName = GetLoginAccountName();
     hdnActionType.Value    = Utils.CheckSql(Request.QueryString["action"].ToLower());
     if (!Page.IsPostBack)
     {
         if (!string.IsNullOrEmpty(this.ID))
         {
             btnModelManageEdit.Text = "修改";
             hdnBackUrlParam.Value   = "";
             string    sql = "select id,title,detail from K_U_Common where id='" + this.ID + "'";
             DataTable dt  = SQLHelper.GetDataSet(sql);
             if (Utils.CheckDataTable(dt))
             {
                 this.editor_detail.Content = dt.Rows[0]["detail"].ToString();
             }
         }
         else
         {
             btnModelManageEdit.Text = "添加";
         }
     }
     this.hsFieldValue = ctrManageEdit.FillField();
     hdnNodeID.Value   = Convert.ToString(hsFieldValue["NodeCode"]);
     hdnSiteID.Value   = Convert.ToString(hsFieldValue["SiteID"]);
 }
        /// <summary>
        /// 初始化
        /// </summary>
        void PageInit()
        {
            hdnActionType.Value = Request.QueryString["action"].ToLower();
            if (!string.IsNullOrEmpty(this.ID))
            {
                btnModelManageEdit.Text = "修改";

                if (this.Page.FindControl("btnAddToOtherNode") != null) // 添加至其它专题
                {
                    this.Page.FindControl("btnAddToOtherNode").Visible = false;
                }
                //if (!string.IsNullOrEmpty(Request.Cookies["ModelPage"].Value))
                //{
                if (hdnBackUrlParam.Value.ToLower().IndexOf("page=") == -1)
                {
                    hdnBackUrlParam.Value = hdnBackUrlParam.Value + "&page=" + GetModelCookes("ModelPage");
                }
                //}
            }
            else
            {
                btnModelManageEdit.Text = "添加";
            }

            this.hsFieldValue = ctrManageEdit.FillField();
            hdnNodeID.Value   = Convert.ToString(hsFieldValue["NodeCode"]);
            hdnSiteID.Value   = Convert.ToString(hsFieldValue["SiteID"]);

            // 传递的ID记录不存在或字段参数有误
            if (this.hsFieldValue == null)
            {
                Response.Write("<script>window.alert(\"传递的ID记录不存在或字段参数有误或没有可编辑的字段。\");history.back();</script>");
                Response.End();
            }

            if (IsHaveRightByOperCode("CreateHtml"))
            {
                isHasCreateHtmlRight = "1";
            }
            else
            {
                isHasCreateHtmlRight = "0";
            }
            if (!string.IsNullOrEmpty(hdnHtmlField.Value))
            {
                string[] arrFieldHtml = hdnHtmlField.Value.Split(',');
                for (int i = 0; i < arrFieldHtml.Length; i++)
                {
                    System.Web.UI.UserControl con = new UserControl();

                    KingTop.Web.Admin.Controls.Editor editid = (KingTop.Web.Admin.Controls.Editor)Page.FindControl(arrFieldHtml[i]);
                    editid.Content = hsFieldValue[(arrFieldHtml[i] + "_").Split('_')[1]].ToString();
                }
            }
        }