Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     sWebinfo = new WebInfor();
     if (!this.IsPostBack)
     {
         DataRow dr = sWebinfo.GetInfo();
         if (dr != null)
         {
             ltlAddCity.Text = dr["contact"].ToString();
             //spanTenCong.Text = dr["TenCongty"].ToString().Trim();
             //ltlFax.Text = dr["Fax"].ToString();
             //ltlWebsite.Text = dr["Website"].ToString();
         }
     }
 }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            if (id != string.Empty)
            {
                sNew = new News();
                DataRow dr = sNew.GetInfoAllByShortLink(id);
                if (dr != null)
                {
                    ltlTitle.Text = dr["titlemeta"].ToString().Trim();
                    sKeyWord      = dr["keywords"].ToString().Trim();
                    sDescription  = dr["Description"].ToString().Trim();
                    stitle        = dr["title"].ToString().Trim();

                    string savatafb       = Globals.UrlHot + dr["fimage"].ToString().Trim();
                    string sTitlefb       = Server.HtmlDecode(dr["title"].ToString().Trim());
                    string sDescriptionfb = Server.HtmlDecode(HtmlRemoval.StripTagsRegex(dr["Summary"].ToString()));

                    HtmlMeta objMetaimg = new HtmlMeta();
                    objMetaimg.Attributes.Add("property", "og:image");
                    objMetaimg.Content = savatafb;
                    this.Page.Header.Controls.Add(objMetaimg);

                    HtmlMeta objMetaTitleFb = new HtmlMeta();
                    objMetaTitleFb.Attributes.Add("property", "og:title");
                    objMetaTitleFb.Content = sTitlefb;
                    this.Page.Header.Controls.Add(objMetaTitleFb);

                    HtmlMeta objMetaDesFb = new HtmlMeta();
                    objMetaDesFb.Attributes.Add("property", "og:description");
                    objMetaDesFb.Content = sDescriptionfb;
                    this.Page.Header.Controls.Add(objMetaDesFb);
                }
            }
            else
            {
                if (groupid != string.Empty)
                {
                    sgroup = new Groups();
                    DataRow dr = sgroup.GetInfoByShortLink(groupid);
                    if (dr != null)
                    {
                        ltlTitle.Text = dr["titlemeta"].ToString().Trim();
                        sKeyWord      = dr["keywords"].ToString().Trim();
                        sDescription  = dr["Description"].ToString().Trim();
                        stitle        = dr["titlemeta"].ToString().Trim();;
                    }
                }
                else
                {
                    sWebinfo = new WebInfor();
                    DataRow dr = sWebinfo.GetInfo();
                    if (dr != null)
                    {
                        ltlTitle.Text = dr["frontend"].ToString().Trim();
                        sKeyWord      = dr["keywords"].ToString().Trim();
                        sDescription  = dr["Description"].ToString().Trim();
                        stitle        = dr["frontend"].ToString().Trim();
                    }
                }
            }
            HtmlMeta objMeta = new HtmlMeta();
            objMeta.Name    = "description";
            objMeta.Content = sDescription; this.Page.Header.Controls.Add(objMeta);
            objMeta         = new HtmlMeta(); objMeta.Name = "keywords"; objMeta.Content = sKeyWord;; this.Page.Header.Controls.Add(objMeta);
            objMeta         = new HtmlMeta(); objMeta.Name = "title"; objMeta.Content = stitle; this.Page.Header.Controls.Add(objMeta);

            GetStyle();
        }
    }