コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string strTitle, strDescription, strMetaTitle, strMetaDescription;
            if (!string.IsNullOrEmpty(Request.QueryString["tt"]))
            {
                var oProduct = new TLLib.Product();
                var dv       = oProduct.ProductSelectOne(Request.QueryString["tt"]).DefaultView;

                if (dv != null && dv.Count <= 0)
                {
                    return;
                }
                var row = dv[0];

                strTitle           = Server.HtmlDecode(row["ProductName"].ToString());
                strDescription     = Server.HtmlDecode(row["Description"].ToString());
                strMetaTitle       = Server.HtmlDecode(row["MetaTittle"].ToString());
                strMetaDescription = Server.HtmlDecode(row["MetaDescription"].ToString());
            }
            else
            {
                strTitle           = strMetaTitle = "Dịch Vụ Gói Quà";
                strDescription     = "";
                strMetaDescription = "";
            }
            Page.Title = !string.IsNullOrEmpty(strMetaTitle) ? strMetaTitle : strTitle;
            var meta = new HtmlMeta()
            {
                Name = "description", Content = !string.IsNullOrEmpty(strMetaDescription) ? strMetaDescription : strDescription
            };
            Header.Controls.Add(meta);
        }
    }
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (((DataView)odsNews.Select()).Count <= DataPager1.PageSize)
            {
                DataPager1.Visible = false;
            }

            string strTitle, strDescription, strMetaTitle, strMetaDescription;
            if (!string.IsNullOrEmpty(Request.QueryString["nw"]))
            {
                var oProduct = new TLLib.Product();
                var dv       = oProduct.ProductSelectOne(Request.QueryString["nw"]).DefaultView;

                if (dv != null && dv.Count <= 0)
                {
                    return;
                }
                var row = dv[0];

                strTitle           = Server.HtmlDecode(row["ProductNameEn"].ToString());
                strDescription     = Server.HtmlDecode(row["DescriptionEn"].ToString());
                strMetaTitle       = Server.HtmlDecode(row["MetaTittleEn"].ToString());
                strMetaDescription = Server.HtmlDecode(row["MetaDescriptionEn"].ToString());

                //hdnSanPham.Value = progressTitle(dv[0]["ProductCategoryName"].ToString()) + "-pci-" + dv[0]["ProductCategoryID"].ToString() + ".aspx";
            }
            else
            {
                strTitle           = strMetaTitle = "News";
                strDescription     = "News";
                strMetaDescription = "News";
            }
            Page.Title = !string.IsNullOrEmpty(strMetaTitle) ? strMetaTitle : strTitle;
            var meta = new HtmlMeta()
            {
                Name = "description", Content = !string.IsNullOrEmpty(strMetaDescription) ? strMetaDescription : strDescription
            };
            Header.Controls.Add(meta);
        }
    }
コード例 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string strTitle, strDescription, strMetaTitle, strMetaDescription;
            if (!string.IsNullOrEmpty(Request.QueryString["pi"]))
            {
                var oProductCategory = new TLLib.ProductCategory();
                var oProduct         = new TLLib.Product();

                var dv  = oProduct.ProductSelectOne(Request.QueryString["pi"]).DefaultView;
                var dv2 = oProductCategory.ProductCategorySelectOne(Request.QueryString["pci"]).DefaultView;

                if (dv != null && dv.Count <= 0)
                {
                    return;
                }
                var row = dv[0];

                strTitle           = Server.HtmlDecode(row["ProductName"].ToString());
                strDescription     = Server.HtmlDecode(row["Description"].ToString());
                strMetaTitle       = Server.HtmlDecode(row["MetaTittle"].ToString());
                strMetaDescription = Server.HtmlDecode(row["MetaDescription"].ToString());

                hdnSanPhamDetails.Value = progressTitle(dv2[0]["ProductCategoryName"].ToString()) + "-pci-" + dv2[0]["ProductCategoryID"].ToString() + ".aspx";
            }
            else
            {
                strTitle           = strMetaTitle = "Sản Phẩm";
                strDescription     = "";
                strMetaDescription = "";
            }
            Page.Title = !string.IsNullOrEmpty(strMetaTitle) ? strMetaTitle : strTitle;
            var meta = new HtmlMeta()
            {
                Name = "description", Content = !string.IsNullOrEmpty(strMetaDescription) ? strMetaDescription : strDescription
            };
            Header.Controls.Add(meta);

            lblProductTitle.Text = strTitle;
        }
    }