资源简介
asp.net新闻网站asp.net新闻网站asp.net新闻网站asp.net新闻网站asp.net新闻网站asp.net新闻网站asp.net新闻网站asp.net新闻网站asp.net新闻网站asp.net新闻网站asp.net新闻网站asp.net新闻网站asp.net新闻网站asp.net新闻网站asp.net新闻网站asp.net新闻网站
代码片段和文件信息
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
public partial class AddNews : System.Web.UI.Page
{
protected void Page_Load(object sender EventArgs e)
{
if(!IsPostBack)
{
this.BindNewsKind();
}
}
protected void BtnAdd_Click(object sender EventArgs e)
{
string Newstitle = this.TxtNewstitle.Text;
int NewsKindId = Convert.ToInt32(this.DropNewsKinds.SelectedValue);
string NewsBody = this.WebNewsBody.Text;
DateTime PubTime = DateTime.Now;
int UserId = Users.GetUserIdByUserName(Session[“UserName“].ToString());
News SingleNews = new News();
SingleNews.Newstitle = Newstitle;
SingleNews.NewsKindId = NewsKindId;
SingleNews.NewsBody = NewsBody;
SingleNews.PubDate = PubTime;
SingleNews.UserId = UserId;
if (News.AddNews(SingleNews))
{
this.LabMessage.Text = “添加成功!“;
}
else
{
this.LabMessage.Text = “添加失败“;
}
}
public void BindNewsKind()
{
this.DropNewsKinds.DataSource = NewsKinds.GetAllNewsKinds();
this.DropNewsKinds.DataTextField = “KindName“;
this.DropNewsKinds.DataValueField = “KindId“;
this.DropNewsKinds.DataBind();
this.DropNewsKinds.SelectedIndex = 0;
}
protected void BtnCreatHtml_Click(object sender EventArgs e)
{
string Newstitle = this.TxtNewstitle.Text;
string NewsKindName = this.DropNewsKinds.SelectedItem.Text;
string NewsBody = this.WebNewsBody.Text;
DateTime PubTime = DateTime.Now;
string UserName = Session[“UserName“].ToString();
Response.Write(NewsKindName);
string[] strNewsHtml = new string[]{NewstitleNewsKindNameNewsBodyPubTime.ToString()UserName};
string[] strOldHtml = new string[] { “@title“ “@NewsKInd“ “@NewsBody“ “@PubTime“ “@UserName“ };
string strFileName=DateTime.Now.ToString(“ddhhmmss“)+“.html“;
string strFilePath = string.Format(“NewsHtml/{0}“strFileName);
try
{
if (Files.CreatHtmlPage(strNewsHtml strOldHtml “mode.htm“ strFilePath))
{
this.LabMessage.Text = “生成成功!“;
}
else
{
this.LabMessage.Text = “生成失败!“;
}
}
catch
{
this.LabMessage.Text = “生成失败!“;
}
}
protected void Button1_Click(object sender EventArgs e)
{
string[] strNewsHtml=new string[]{“看看我们生成的首页“};
string[] strStartHtml=new string[]{““};
string[] strEndHtml
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 932 2007-05-20 19:28 源码\News\20072816.html
文件 4377 2007-05-21 23:40 源码\News\AddNews.aspx
文件 7782 2007-05-21 23:40 源码\News\AddNews.aspx.cs
文件 5657 2007-05-17 21:30 源码\News\Admin.aspx
文件 3258 2007-05-17 21:30 源码\News\Admin.aspx.cs
文件 5613 2007-05-10 22:56 源码\News\App_Code\Databa
文件 3320 2007-05-20 19:40 源码\News\App_Code\Files.cs
文件 7196 2007-05-27 20:48 源码\News\App_Code\News.cs
文件 1973 2007-05-15 23:56 源码\News\App_Code\NewsKinds.cs
文件 6396 2007-05-25 22:13 源码\News\App_Code\Users.cs
文件 159744 2006-10-21 11:00 源码\News\Bin\DotNetTextBox.dll
文件 3834 2007-05-27 21:22 源码\News\Default.aspx
文件 1780 2007-05-27 21:25 源码\News\Default.aspx.cs
文件 373248 2007-05-21 23:00 源码\News\files\00112145.ppt
文件 375296 2007-05-21 23:31 源码\News\files\31112123.ppt
文件 2870 2007-05-21 23:31 源码\News\files\31112123.txt
文件 373248 2007-05-21 23:32 源码\News\files\32112119.ppt
文件 2870 2007-05-21 23:32 源码\News\files\32112119.txt
文件 575530 2007-05-21 22:56 源码\News\files\56102129.bmp
文件 1971 2007-05-13 14:47 源码\News\Login.aspx
文件 947 2007-05-11 00:52 源码\News\Login.aspx.cs
文件 404 2007-05-23 23:38 源码\News\Menu.ascx
文件 976 2007-05-17 21:28 源码\News\Menu.ascx.cs
文件 809 2007-05-20 19:44 源码\News\mode.htm
文件 838 2007-05-20 20:00 源码\News\NewsHtml\20074442.html
文件 3464 2007-05-27 20:31 源码\News\ShowNews.aspx
文件 5661 2007-05-27 20:18 源码\News\ShowNews.aspx.cs
文件 2613 2006-10-24 16:56 源码\News\skin\default\aspnet2.gif
文件 4315 2002-12-03 08:38 源码\News\skin\default\bgcolor.aspx
文件 3650 2002-12-01 00:17 源码\News\skin\default\calculator.aspx
............此处省略480个文件信息
评论
共有 条评论