Ejemplo n.º 1
0
 /// <summary>
 /// 控件绑定事件
 /// </summary>
 /// <param name="source"></param>
 /// <param name="e"></param>
 protected void repInfo_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "del")
     {
         int id  = Convert.ToInt32(e.CommandArgument);
         int num = KeyWordInfoService.Delete(id);
         if (num > 0)
         {
             ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('删除成功!');", true);
         }
         else
         {
             ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('删除失败,请重试!');", true);
         }
         sp.InitBindData(Repeater1, pager1, "KeyWordInfo", "id", "1=1");
     }
     else if (e.CommandName == "mod")
     {
         int         id   = Convert.ToInt32(e.CommandArgument);
         KeyWordInfo item = KeyWordInfoService.GetModel(id);
         if (item != null)
         {
             txtPageName.Text   = item.pageName;
             txtTitle.Text      = item.title;
             txtKeyWord.Text    = item.keyword;
             txtDesc.Text       = item.description;
             txtURL.Text        = item.pageNameValue;
             ViewState["modId"] = item.id;
             ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "overKeyWordDiv();", true);
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 页面标题、关键字和描述信息
        /// </summary>
        private void KeyWordBind()
        {
            string url = Request.Url.ToString().Replace("aspx", "html");

            KeyWordInfo km = KeyWordInfoService.GetModel(url);

            if (km != null)
            {
                ViewState["title"]   = km.title;
                ViewState["keyword"] = km.keyword;
                ViewState["miaoshu"] = km.description;
            }
            else
            {
                ViewState["title"]   = BaseConfigService.GetById(9);
                ViewState["keyword"] = BaseConfigService.GetById(23);
                ViewState["miaoshu"] = BaseConfigService.GetById(13);
            }
        }