当前位置: 代码迷 >> ASP.NET >> 高分求解 有分页的aspx页面怎么生成静态页面
  详细解决方案

高分求解 有分页的aspx页面怎么生成静态页面

热度:8511   发布时间:2013-02-25 00:00:00.0
高分求解 有分页的aspx页面如何生成静态页面?
http://topic.csdn.net/u/20080521/14/4940a828-e2e7-44b1-a592-de4f59a23e56?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)                        {                            ChannelInfo subinfo = new ChannelInfo();                            subinfo.Cid = new Guid(dri["Cid"].ToString());                            subinfo = new Channel().GetChannelInfo(subinfo);                            string sstrShortening = subinfo.ChannelShortening.ToUpper();                            //文字新闻                            string spattern = @"\{\$WUYOU" + sstrShortening + @"List,(?<ListCount>\d*)\$\}";                            strContent = GetReplaceString(strContent,spattern,  subinfo);                            //生成图片新闻                            spattern = @"\{\$WUYOUIMG" + sstrShortening + @"List,(?<ListCount>\d*)\$\}";                            strContent = GetMacthIMGString(spattern, strContent, subinfo);                            //生成推荐图片新闻                            pattern = @"\{\$WUYOUIMG" + strShortening + @"TopList,(?<ListCount>\d*)\$\}";                            strContent = GetMacthIMGString(pattern, strContent, theinfo, true);                        }                    }                    /*系统菜单*/                    pattern = @"\{\$WUYOUTOPMENU\$\}";                    countMatch = GetMatchCount(pattern, strContent);                    for (int index = 0; index < countMatch; index++)                    {                        strContent = GetMatchString(pattern, strContent, GetChannelMenuString(new ChannelInfo(),true));                    }                    /*栏目标题*/                    pattern = @"\{\$WUYOUCHANTITLE\$\}";                    countMatch = GetMatchCount(pattern, strContent);                       for (int index = 0; index < countMatch; index++)                    {                        strContent = GetMatchString(pattern, strContent, theinfo.ChannelTitle);                    }                    /*相关栏目*/                    pattern = @"\{\$WUYOUAboutChannel\$\}";                    countMatch = GetMatchCount(pattern, strContent);                       for (int index = 0; index < countMatch; index++)                    {                        strContent = GetMatchString(pattern, strContent, GetChannelListString(theinfo));                    }                    /*栏目导航{$WUYOUCHANNAV$}*/                    pattern = @"\{\$WUYOUCHANNAV\$\}";                    countMatch = GetMatchCount(pattern, strContent);                       for (int index = 0; index < countMatch; index++)                    {                        strContent = GetMatchString(pattern, strContent, GetChannelNav(theinfo, null));                    }                    /*投票系统{$WUYOUVote$}*/                    pattern = @"\{\$WUYOUVOTE\$\}";                    countMatch = GetMatchCount(pattern, strContent);                    for (int index = 0; index < countMatch; index++)                    {                        strContent = GetMatchString(pattern, strContent, GetVoteString());                    }                    /*单页面内容部分*/                    pattern = @"\{\$WUYOUSIMPCONTENT\$\}";                    countMatch = GetMatchCount(pattern, strContent);                       for (int index = 0; index < countMatch; index++)                    {                        strContent = GetMatchString(pattern, strContent, GetSimplexContentString(theinfo));                    }
  相关解决方案