protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { CommonFunction.isLoginCheck(); ViewState["HTML"] = ""; ViewState["strAction"] = Request.QueryString["action"]; int tid = Convert.ToInt32(Request.QueryString["tid"]); ViewState["dtType"] = NewsInfoService.Get_TypeInfoByTypeId(tid); if (Request.QueryString["nid"] != null) { int nid = Convert.ToInt32(Request.QueryString["nid"]); ViewState["nid"] = nid; DataTable dt = NewsInfoService.Get_NewsInfo(nid); txtTitle.Text = dt.Rows[0]["N_Title"].ToString(); txtTime.Text = Convert.ToDateTime(dt.Rows[0]["N_Time"].ToString()).ToShortDateString(); txtFrom.Text = dt.Rows[0]["N_From"].ToString(); ViewState["HTML"] = dt.Rows[0]["N_ImgPath"].ToString(); } else { txtTime.Text = DateTime.Now.ToShortDateString(); txtFrom.Text = "本站原创"; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int id = Convert.ToInt32(Request.QueryString["id"].ToString()); Table = NewsInfoService.Get_NewsInfo(id); this.Panel_img.Visible = Property.HaveImg(id); BindTitleAndMenu(id); } }
public static bool HaveImg(int oid) { bool result = false; DataTable dt = NewsInfoService.Get_NewsInfo(oid); foreach (DataRow dr in dt.Rows) { if (dr["N_ImgPath"].ToString() != "") { result = true; } } return(result); }