[急]怎么让文章内容分页? 一篇文章内容长了,有什么办法分页? 环境: vs2005 +access 数据库 ? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 放在TextBox中然后设置一下TextBox的样式布就可以了费什么劲搞什么分页啊 www.16sw.com本站有分页实例,实例上面还有上传文章等之类的,源程序公开,欢迎下载 一般WEB编辑都有插入分页标记的按钮,通过分页标记拆分新闻内容放在数组中,然后调用数组下标设置分页。我的代码如下,供参考!! private News news=new News(); private NewsHdl newshdl=new NewsHdl(); private string [] split_content; private string split_str="[pagebr]"; //分页截断字符 private string footPage=""; private string id; private string getPageSize; private int pagecount; //总页数 private int currentpage; //当前页 protected Const consts=new Const("SiteConst.xml"); private void Page_Load(object sender, System.EventArgs e) { if(!this.IsPostBack) { id=Request.QueryString["newsid"]; getPageSize=Request.QueryString["page"]; news=newshdl.getNews(id); this.l_newstitle.Text=news.getNewstitle(); this.l_newsdate.Text=news.getNewsDate(); this.l_newsauthor.Text=news.getNewsAuthor(); this.l_newssource.Text=news.getNewsSource(); split_content=Regex.Split(news.getNewsContent(),split_str,RegexOptions.IgnoreCase); pagecount=split_content.Length; getPageSize=this. /** * * 判断新闻内容是否分页 * */ if(split_content.Length>1) { footPage="第"; for(int i=0;i<split_content.Length;i++) { currentpage=i+1; //当前页 footPage+="<a class=pagerTxt href=newsShow.aspx?newsid="+id+"&page="+currentpage+">["+currentpage+"] </a> "; } if(getPageSize!=null) footPage+="页<font color=red>"+getPageSize+"</font>/"+pagecount+" "; //打印当前页和总页数 else footPage+="页<font color=red>1</font>/"+pagecount+" "; //打印当前页和总页数 this.l_page.Text=footPage; } else { this.l_newscontent.Text=news.getNewsContent(); this.l_page.Visible=false; } /** * 判断提交的页码 * */ if(getPageSize!=null) //判断提交的页码 { this.l_newscontent.Text=split_content[Convert.ToInt32(getPageSize)-1]; } else { this.l_newscontent.Text=split_content[0]; } } www.16sw.com就有源码啊是分页的,可以上去下载 关于框架之间的传值?大侠帮帮忙啊!很急呀!!! 请帮忙!使用了updatepanel,网页仍然postback,急!!! 如何将DataGrid中的显示的数据插入到access数据库 字符串处理问题,急!!!!! 2.0中Eval区分大小写吗? 如何控制访问安全 关于博客的问题 高分询问关于asp table 和 datagrid 本地没有错误,放到服务器上出现这样的错误,求前辈指点,谢谢!!! 枚举的使用问题 100问个排序,查询分页的问题,帮顶有分! >>>>>>>>>>>>>>>>>>>>>>怎样让GridView数据在button点击后更新?
本站有分页实例,实例上面还有上传文章等之类的,源程序公开,欢迎下载
private News news=new News();
private NewsHdl newshdl=new NewsHdl();
private string [] split_content;
private string split_str="[pagebr]"; //分页截断字符
private string footPage="";
private string id;
private string getPageSize;
private int pagecount; //总页数
private int currentpage; //当前页
protected Const consts=new Const("SiteConst.xml");
private void Page_Load(object sender, System.EventArgs e)
{ if(!this.IsPostBack)
{
id=Request.QueryString["newsid"];
getPageSize=Request.QueryString["page"];
news=newshdl.getNews(id);
this.l_newstitle.Text=news.getNewstitle();
this.l_newsdate.Text=news.getNewsDate();
this.l_newsauthor.Text=news.getNewsAuthor();
this.l_newssource.Text=news.getNewsSource();
split_content=Regex.Split(news.getNewsContent(),split_str,RegexOptions.IgnoreCase);
pagecount=split_content.Length;
getPageSize=this.
/**
*
* 判断新闻内容是否分页
* */
if(split_content.Length>1)
{
footPage="第";
for(int i=0;i<split_content.Length;i++)
{
currentpage=i+1; //当前页
footPage+="<a class=pagerTxt href=newsShow.aspx?newsid="+id+"&page="+currentpage+">["+currentpage+"] </a> ";
}
if(getPageSize!=null)
footPage+="页<font color=red>"+getPageSize+"</font>/"+pagecount+" "; //打印当前页和总页数
else
footPage+="页<font color=red>1</font>/"+pagecount+" "; //打印当前页和总页数
this.l_page.Text=footPage;
}
else
{
this.l_newscontent.Text=news.getNewsContent();
this.l_page.Visible=false;
} /**
* 判断提交的页码
* */ if(getPageSize!=null) //判断提交的页码
{
this.l_newscontent.Text=split_content[Convert.ToInt32(getPageSize)-1];
}
else
{
this.l_newscontent.Text=split_content[0]; }
}
是分页的,可以上去下载