Пример #1
0
 /// <summary>替换image控件图片,若有需要,物理删除原文件</summary>
 /// <param name="img">图像控件</param>
 /// <param name="newImageUrl">新图片虚拟路径</param>
 public static void SetImage(FineUI.Image img, string newImageUrl, bool deleteOldImage = false)
 {
     if (deleteOldImage)
     {
         Common.SafeDeleteFile(img.ImageUrl);
     }
     img.ImageUrl = newImageUrl;
 }
Пример #2
0
        protected void Page_Init(object sender, EventArgs e)
        {
            ds = new DataSet();
            ds = manage.GetSearchList(" t.id= '" + Request["id"].ToString() + "' ");
            if (ds.Tables[0].Rows.Count != 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    ViewState["PROPERTYID"]   = ds.Tables[0].Rows[i]["PROPERTYID"].ToString();
                    ViewState["PROPERTYTYPE"] = ds.Tables[0].Rows[i]["PROPERTYTYPE"].ToString();
                    switch (ds.Tables[0].Rows[i]["PROPERTYTYPE"].ToString())
                    {
                    case "0":
                        tb           = new FineUI.TextBox();
                        tb.ID        = "txtInput";
                        tb.Label     = ds.Tables[0].Rows[i]["PROPERTYNAME"].ToString();
                        tb.ShowLabel = true;
                        FormPanel.Items.Add(tb);
                        break;

                    case "1":
                        fl           = new FineUI.FileUpload();
                        fl.ID        = "up1";
                        fl.Label     = "高分辨率BANNER";
                        fl.ShowLabel = true;
                        FormPanel.Items.Add(fl);
                        img1        = new FineUI.Image();
                        img1.ID     = "ig1";
                        img1.Hidden = true;
                        FormPanel.Items.Add(img1);
                        fl           = new FineUI.FileUpload();
                        fl.ID        = "up2";
                        fl.Label     = "低分辨率BANNER";
                        fl.ShowLabel = true;
                        FormPanel.Items.Add(fl);
                        img2        = new FineUI.Image();
                        img2.ID     = "ig2";
                        img2.Hidden = true;
                        FormPanel.Items.Add(img2);
                        break;

                    case "2":
                        he           = new FineUI.HtmlEditor();
                        he.ID        = "he1";
                        he.Label     = ds.Tables[0].Rows[i]["PROPERTYNAME"].ToString();
                        he.ShowLabel = true;
                        FormPanel.Items.Add(he);
                        break;
                    }
                }
            }
            FineUI.TextBox    tbx   = FormPanel.FindControl("txtInput") as FineUI.TextBox;
            FineUI.FileUpload fu1   = FormPanel.FindControl("up1") as FineUI.FileUpload;
            FineUI.FileUpload fu2   = FormPanel.FindControl("up2") as FineUI.FileUpload;
            HtmlEditor        html1 = FormPanel.FindControl("he1") as HtmlEditor;

            ds = new DataSet();
            ds = mPv.GetList(" cms_property_value.tagid = '" + Request["id"].ToString() + "'");



            if (ds.Tables[0].Rows.Count > 0)
            {
                ViewState["type"] = "1";
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    ViewState["ID"] = ds.Tables[0].Rows[i]["ID"].ToString();
                    //ViewState["PROPERTYID"] = ds.Tables[0].Rows[i]["PROPERTYID"].ToString();

                    switch (ds.Tables[0].Rows[i]["PROPERTYTYPE"].ToString())
                    {
                    case "0":
                        tbx.Text = ds.Tables[0].Rows[i]["PROPERTYVALUE"].ToString();
                        break;

                    case "1":
                        if (ds.Tables[0].Rows[i]["PROPERTYTYPE"] != null && ds.Tables[0].Rows[i]["PROPERTYTYPE"].ToString() != "")
                        {
                            string[] strUpload = ds.Tables[0].Rows[i]["PROPERTYVALUE"].ToString().Split(',');

                            ViewState["up1"] = strUpload[0].ToString();
                            ViewState["up2"] = strUpload[1].ToString();
                            img1.ImageUrl    = strUpload[0].ToString();
                            img2.ImageUrl    = strUpload[1].ToString();
                            img1.Hidden      = false;
                            img2.Hidden      = false;
                        }
                        else
                        {
                            ViewState["up1"] = "";
                            ViewState["up2"] = "";
                        }
                        break;

                    case "2":
                        html1.Text = ds.Tables[0].Rows[i]["PROPERTYVALUE"].ToString();
                        break;
                    }
                }
            }
            else
            {
                ViewState["type"] = "0";
            }
        }