protected void DownloadsBind(int number, int pagesize) { List <DownloadsModel> list = EispDownloadsBLL.GetDownloadsListByLang(lang, number, pagesize); this.GridView1.DataSource = list; this.GridView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { DownloadsBind(EispDownloadsBLL.GetRecordCountByLang(lang), 20); } }
protected void Page_Load(object sender, EventArgs e) { if (VerifyTool.IsInt(Request.QueryString["page"])) { CurrentPage = Convert.ToInt32(Request.QueryString["page"]); //要减去的记录数 int subtract_number = 20 * (CurrentPage - 1); //要获取的记录数:记录总数-要减去的记录数 int number = EispDownloadsBLL.GetRecordCountByLang(lang) - subtract_number; if (EispDownloadsBLL.GetRecordCountByLang(lang) > 0) { BindDownloads(number, 20, EispDownloadsBLL.GetRecordCountByLang(lang)); } } else { if (EispDownloadsBLL.GetRecordCountByLang(lang) > 0) { BindDownloads(EispDownloadsBLL.GetRecordCountByLang(lang), 20, EispDownloadsBLL.GetRecordCountByLang(lang)); } } //Page.Title = " 公司简介"; Page.Title = "资料下载"; }
protected void btnAdd_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.txtTitle.Text)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "msg", "alert('标题不能为空!')", true); return; } string smallfileurl = txtImgPath.Text; smallfileurl = smallfileurl.ToLower(); smallfileurl = smallfileurl.Replace("userfiles", "userfiles/_thumbs"); long filesize = 0; DownloadsModel s = new DownloadsModel(); string filePath = txtFilePath.Text; s.F_Size = filesize.ToString(); s.F_FileType = Convert.ToInt16(drpFileClass.SelectedValue); //Convert.ToInt32(this.txtRegion.SelectedValue); s.F_Content = filePath; //VerifyTool.DeleteScript(this.content.Value); s.F_Desc = txtDesc.Text; s.F_Lang = lang; s.F_Title = txtTitle.Text; s.F_Keywords = txtKeywords.Text; s.F_FileImage = txtImgPath.Text; s.F_FileSmallImage = smallfileurl; int res = EispDownloadsBLL.ADD(s); if (res > 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "msg", "alert('添加成功!');location.href='DownloadAdmin.aspx?lang=" + lang + "'", true); } }
protected void btnDelete_Click(object sender, EventArgs e) { foreach (GridViewRow row in this.GridView1.Rows) { if (((CheckBox)row.FindControl("chk")).Checked) { int id = Convert.ToInt32(((Label)row.FindControl("id")).Text); EispDownloadsBLL.Delete(id); } } Page.ClientScript.RegisterStartupScript(this.GetType(), "msg", "alert('删除成功')", true); DownloadsBind(EispDownloadsBLL.GetRecordCountByLang(lang), 20); }
// //绑定新闻 protected void BindDownloads(int number, int pagesize, int recordcount) { List <DownloadsModel> list = EispDownloadsBLL.GetDownloadsListByLang(lang, number, pagesize); AspNetPager.RecordCount = recordcount; AspNetPager.CurrentPageIndex = number; AspNetPager.PageSize = pagesize; Records = recordcount; RecordsPage = int.Parse(pages); StringBuilder sb = new StringBuilder(); foreach (DownloadsModel n in list) { sb.Append("<div class=\"DownloadListRow\"><table width=\"100%\" height=\"100%\" valign=\"top\"><tr><td width='130'><a href=\"" + n.F_Content + "\"><img width='150px' height='204px' src=\"" + n.F_FileImage + "\"></a></td><td valign=\"top\"><div class=\"DownloadRowTitle\"><a href=\"" + n.F_Content + "\">" + n.F_Title + " </a>[" + n.F_Date.ToString("yyyy-MM-dd") + "]</div><div class=\"DownloadRowTitle\">" + n.F_Keywords + "</div><div class=\"DownloadRowTitle\">" + n.F_Desc + "</div></td></tr></table></div>"); } NewsHtml = sb.ToString(); }
protected void Page_Load(object sender, EventArgs e) { List <DownloadsModel> list = EispDownloadsBLL.GetDownloadsListByLang(lang, 5, 5); StringBuilder sb = new StringBuilder(); foreach (DownloadsModel d in list) { string TitleStr = string.Empty; TitleStr = d.F_Title; if (TitleStr.Length > 20) { TitleStr = TitleStr.Substring(0, 18) + "..."; } sb.Append("<div class=\"DownloadRow\"><a target=\"_blank\" alt=\"" + d.F_Title + "\" href=\"" + d.F_Content + "\">" + TitleStr + "</a></div>"); } downloadlist = sb.ToString(); }