日期:2014-05-18  浏览次数:20442 次

高分求解 有分页的aspx页面如何生成静态页面?
http://topic.csdn.net/u/20080521/14/4940a828-e2e7-44b1-a592-de4f59a23e56.html?seed=1701902541
上面是原帖。
现在用的方法似乎不能有效地生成分页导航栏。看来要换个思路来解决了。在此求方法。

------解决方案--------------------
友情帮顶
------解决方案--------------------
我是我以前写的生成静态页面的方法(包括了分页)


C# code
        /// <summary>
        /// 生成栏目静态页面
        /// </summary>
        /// <param name="info">栏目名称,如果要生成首页,为null</param>
        /// <returns></returns>
        public bool GerChannelHtmlForEach(ChannelInfo info)
        {
            string strShortening, pattern;
            int countMatch;
            string strContent = string.Empty;
            string strTitle = string.Empty;
            if (info == null||info.ExtUrl.Length < 1)
            {
                TemplateInfo tinfo = new TemplateInfo();
                BTemplate temp = new BTemplate();
                if (info == null)
                {
                    tinfo.TName = "首页模板";
                    strTitle = Config.WebSiteTitle + " - 首页";
                    
                }else
                {
                    /*获取模板内容*/

                    tinfo.Tid = info.TemplateID;
                    strTitle = GetTitleStringForPage(info);
                }
                strContent += GetHeadHTML();
                strContent += temp.GetTempInfo(tinfo).TContent;
                strContent += GetFooterHTML();

                /*页面标题*/
                pattern = @"\{\$WUYOUPAGETITLE\$\}";
                countMatch = GetMatchCount(pattern, strContent);
                for (int index = 0; index < countMatch; index++)
                {
                    strContent = GetMatchString(pattern, strContent, strTitle);
                }

                Channel channel = new Channel();
                ChannelInfo pinfo = new ChannelInfo(); ;
                if(info != null)
                {
                    pinfo = info;
                }

                DataTable dtChannel = channel.GetChannelList(pinfo);
                foreach (DataRow dr in dtChannel.Rows)
                {
                    ChannelInfo theinfo = new ChannelInfo();
                    theinfo.Cid = new Guid(dr["Cid"].ToString());
                    theinfo = channel.GetChannelInfo(theinfo);

                    /************************************************************************/
                    /* 声明,标签以List结尾的一般都需要加参数 ",数字"一个标点逗号和一个数字(英语数字)
                    /************************************************************************/
                    //{$WUYOUXWDTList,3$}
                    //生成文字新闻
                    strShortening = theinfo.ChannelShortening.ToString().ToUpper();
                    pattern = @"\{\$WUYOU" + strShortening + @"List,(?<ListCount>\d*)\$\}";
                    strContent = GetReplaceString(strContent, pattern, theinfo);

                    //{$WUYOUIMGXWDT$}
                    //生成图片新闻
                    pattern = @"\{\$WUYOUIMG" + strShortening + @"List,(?<ListCount>\d*)\$\}";
                    strContent = GetMacthIMGString(pattern, strContent, theinfo);

                    //{$WUYOUIMGXWDTTopList,4$}
                    //生成推荐图片新闻
                    pattern = @"\{\$WUYOUIMG" + strShortening + @"TopList,(?<ListCount>\d*)\$\}";
                    strContent = GetMacthIMGString(pattern, strContent, theinfo,true);



                    //子栏目下的图片和文字新闻
                    ChannelInfo ainfo = new ChannelInfo();
                    ainfo.ParentID = theinfo.Cid;
                    DataTable subChannel = new Channel().GetChannelList(ainfo);
                    if (subChannel.Rows.Count > 0)
                    {
                        foreach (DataRow dri in subChannel.Rows)