protected void lvNews_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) { Label lblnID = (Label)lvNews.Rows[e.NewSelectedIndex].FindControl("lblnID"); int nNewsID = 0; if (int.TryParse(lblnID.Text, out nNewsID) && nNewsID > 0) { DBLL.clsNews clsnews = new DBLL.clsNews(); DataTable dtnewsone = clsnews.Select_tb_NewsBynNewsID(nNewsID); if (dtnewsone != null && dtnewsone.Rows.Count > 0) { Panel1.Visible = false; Panel2.Visible = true; Label1.Text = dtnewsone.Rows[0]["sTitle"].ToString(); lblsAuthor.Text = dtnewsone.Rows[0]["sAuthor"].ToString(); lblsCreatedBy.Text = dtnewsone.Rows[0]["dCreatedTime"].ToString(); Image1.ImageUrl = dtnewsone.Rows[0]["sImagePath"].ToString(); if (Image1.ImageUrl == "") { Image1.Visible = false; } divNewsdetail.InnerHtml = dtnewsone.Rows[0]["sContent"].ToString(); } } }
protected void lvNews_SelectedIndexChanging(object sender, ListViewSelectEventArgs e) { try { Label lblnID = (Label)lvNews.Items[e.NewSelectedIndex].FindControl("lblnID"); int nID = 0; if (int.TryParse(lblnID.Text.Trim(), out nID) && nID > 0) { DBLL.clsNews clsnews = new DBLL.clsNews(); DataTable dtnews = clsnews.Select_tb_NewsBynNewsID(nID); if (dtnews != null && dtnews.Rows.Count > 0) { lblNewsDetailtitle.Text = dtnews.Rows[0]["sTitle"].ToString(); lblNewsDetailTime.Text = dtnews.Rows[0]["dCreatedTime"].ToString(); divNewsDetail.InnerHtml = dtnews.Rows[0]["sContent"].ToString(); PnlNewsDetail.Visible = true; lvNews.Visible = false; } } } catch (Exception) { throw; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int nID = 0; if (Request.QueryString["nID"] != null && int.TryParse(Request.QueryString["nID"].ToString(), out nID) && nID > 0) { lblBigtitle.Text = "编辑数据"; BtnAdd.Visible = false; btnUpdate.Visible = true; DBLL.clsNews clNews = new DBLL.clsNews(); DataTable dt = clNews.Select_tb_NewsBynNewsID(nID); if (dt != null && dt.Rows.Count > 0) { hfID.Value = dt.Rows[0]["nNewsID"].ToString(); RadioButtonList2.SelectedValue = dt.Rows[0]["nLangType"].ToString(); txtsTitle.Text = dt.Rows[0]["sTitle"].ToString(); txtsAuthor.Text = dt.Rows[0]["sAuthor"].ToString(); Image3.ImageUrl = dt.Rows[0]["sImagePath"].ToString(); if (Image3.ImageUrl != "") { lblsImagePath.Visible = false; MutileUploaderUserControl31.Visible = false; Label2.Visible = true; Button1.Visible = true; Image3.Visible = true; } else { lblsImagePath.Visible = true; MutileUploaderUserControl31.Visible = true; Label2.Visible = false; Button1.Visible = false; Image3.Visible = false; } CKEditorControl1.Text = dt.Rows[0]["sContent"].ToString(); txtnSorting.Text = dt.Rows[0]["nSorting"].ToString(); //绑定数据 } } else { lblBigtitle.Text = "添加数据"; btnUpdate.Visible = false; BtnAdd.Visible = true; Label2.Visible = false; Button1.Visible = false; Image3.Visible = false; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DBLL.clsJob clsjob = new DBLL.clsJob(); DBLL.DBcommon dbcon = new DBLL.DBcommon(); BindData(); lblcur.Text = (lvNews.PageIndex + 1).ToString(); lbltotal.Text = lvNews.PageCount.ToString(); int nNewsID = 0; if (Request.QueryString["nNewsID"] != null && int.TryParse(Request.QueryString["nNewsID"].ToString(), out nNewsID) && nNewsID > 0) { DBLL.clsNews clsnews = new DBLL.clsNews(); DataTable dtnewsone = clsnews.Select_tb_NewsBynNewsID(nNewsID); if (dtnewsone != null && dtnewsone.Rows.Count > 0) { Panel1.Visible = false; Panel2.Visible = true; Label1.Text = dtnewsone.Rows[0]["sTitle"].ToString(); lblsAuthor.Text = dtnewsone.Rows[0]["sAuthor"].ToString(); lblsCreatedBy.Text = dtnewsone.Rows[0]["dCreatedTime"].ToString(); Image1.ImageUrl = dtnewsone.Rows[0]["sImagePath"].ToString(); if (Image1.ImageUrl == "") { Image1.Visible = false; } divNewsdetail.InnerHtml = dtnewsone.Rows[0]["sContent"].ToString(); } } else { Panel1.Visible = true; Panel2.Visible = false; } if (DataTableNews == null || DataTableNews.Rows.Count < 1) { Label14.Visible = true; } else { Label14.Visible = false; } } OnSetLanguage(); }
protected void lvNewsList_SelectedIndexChanging(object sender, ListViewSelectEventArgs e) { Label lblnID = (Label)lvNewsList.Items[e.NewSelectedIndex].FindControl("lblnNewsID"); int _nID = 0; DBLL.clsNews News = new DBLL.clsNews(); if (int.TryParse(lblnID.Text.Trim(), out _nID) && _nID > 0) { MultiView1.ActiveViewIndex = 1; DBLL.DBcommon dbcom = new DBLL.DBcommon(); DataTable TopicCategorydt = dbcom.selectNormalTableofAll(false, "tb_TopicCategory"); ddlnTCategoryID.DataSource = TopicCategorydt; ddlnTCategoryID.DataValueField = "nTCategoryID"; ddlnTCategoryID.DataTextField = "sTCategoryNameCN"; ddlnTCategoryID.DataBind(); DataTable dt = News.Select_tb_NewsBynNewsID(_nID); ddlnTCategoryID.SelectedValue = dt.Rows[0]["nTCategoryID"].ToString(); txtsTitle.Text = dt.Rows[0]["sTitle"].ToString(); txtsAuthor.Text = dt.Rows[0]["sAuthor"].ToString(); rblnLangType.SelectedValue = dt.Rows[0]["nLangType"].ToString(); Image3.ImageUrl = dt.Rows[0]["sImagePath"].ToString(); if (Image3.ImageUrl != "") { lblsImagePath.Visible = false; MutileUploaderUserControl3.Visible = false; Label2.Visible = true; Button1.Visible = true; Image3.Visible = true; } else { lblsImagePath.Visible = true; MutileUploaderUserControl3.Visible = true; Label2.Visible = false; Button1.Visible = false; Image3.Visible = false; } CKEditorControl1.Text = dt.Rows[0]["sContent"].ToString(); ddlnSorting.SelectedValue = dt.Rows[0]["nSorting"].ToString(); MutileUploaderUserControl3.Refresh(); hfNewsUpdateID.Value = _nID.ToString(); } }