private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, ListInfo listInfo) { var parsedContent = string.Empty; var type = listInfo.Others.Get(Type); if (string.IsNullOrEmpty(type)) { type = BackgroundContentAttribute.ImageUrl; } var contextType = EContextType.Each; IEnumerable dataSource = null; var contentInfo = contextInfo.ContentInfo; if (contentInfo != null) { var eachList = new List <string>(); if (!string.IsNullOrEmpty(contentInfo.GetString(type))) { eachList.Add(contentInfo.GetString(type)); } var extendAttributeName = ContentAttribute.GetExtendAttributeName(type); var extendValues = contentInfo.GetString(extendAttributeName); if (!string.IsNullOrEmpty(extendValues)) { foreach (var extendValue in TranslateUtils.StringCollectionToStringList(extendValues)) { eachList.Add(extendValue); } } if (listInfo.StartNum > 1 || listInfo.TotalNum > 0) { if (listInfo.StartNum > 1) { var count = listInfo.StartNum - 1; if (count > eachList.Count) { count = eachList.Count; } eachList.RemoveRange(0, count); } if (listInfo.TotalNum > 0) { if (listInfo.TotalNum < eachList.Count) { eachList.RemoveRange(listInfo.TotalNum, eachList.Count - listInfo.TotalNum); } } } dataSource = eachList; } if (listInfo.Layout == ELayout.None) { var rptContents = new Repeater { ItemTemplate = new RepeaterTemplate(listInfo.ItemTemplate, listInfo.SelectedItems, listInfo.SelectedValues, listInfo.SeparatorRepeatTemplate, listInfo.SeparatorRepeat, pageInfo, contextType, contextInfo) }; if (!string.IsNullOrEmpty(listInfo.HeaderTemplate)) { rptContents.HeaderTemplate = new SeparatorTemplate(listInfo.HeaderTemplate); } if (!string.IsNullOrEmpty(listInfo.FooterTemplate)) { rptContents.FooterTemplate = new SeparatorTemplate(listInfo.FooterTemplate); } if (!string.IsNullOrEmpty(listInfo.SeparatorTemplate)) { rptContents.SeparatorTemplate = new SeparatorTemplate(listInfo.SeparatorTemplate); } if (!string.IsNullOrEmpty(listInfo.AlternatingItemTemplate)) { rptContents.AlternatingItemTemplate = new RepeaterTemplate(listInfo.AlternatingItemTemplate, listInfo.SelectedItems, listInfo.SelectedValues, listInfo.SeparatorRepeatTemplate, listInfo.SeparatorRepeat, pageInfo, contextType, contextInfo); } rptContents.DataSource = dataSource; rptContents.DataBind(); if (rptContents.Items.Count > 0) { parsedContent = ControlUtils.GetControlRenderHtml(rptContents); } } else { var pdlContents = new ParsedDataList(); TemplateUtility.PutListInfoToMyDataList(pdlContents, listInfo); pdlContents.ItemTemplate = new DataListTemplate(listInfo.ItemTemplate, listInfo.SelectedItems, listInfo.SelectedValues, listInfo.SeparatorRepeatTemplate, listInfo.SeparatorRepeat, pageInfo, contextType, contextInfo); if (!string.IsNullOrEmpty(listInfo.HeaderTemplate)) { pdlContents.HeaderTemplate = new SeparatorTemplate(listInfo.HeaderTemplate); } if (!string.IsNullOrEmpty(listInfo.FooterTemplate)) { pdlContents.FooterTemplate = new SeparatorTemplate(listInfo.FooterTemplate); } if (!string.IsNullOrEmpty(listInfo.SeparatorTemplate)) { pdlContents.SeparatorTemplate = new SeparatorTemplate(listInfo.SeparatorTemplate); } if (!string.IsNullOrEmpty(listInfo.AlternatingItemTemplate)) { pdlContents.AlternatingItemTemplate = new DataListTemplate(listInfo.AlternatingItemTemplate, listInfo.SelectedItems, listInfo.SelectedValues, listInfo.SeparatorRepeatTemplate, listInfo.SeparatorRepeat, pageInfo, contextType, contextInfo); } pdlContents.DataSource = dataSource; pdlContents.DataBind(); if (pdlContents.Items.Count > 0) { parsedContent = ControlUtils.GetControlRenderHtml(pdlContents); } } return(parsedContent); }
public string Parse(int totalNum, int currentPageIndex, int pageCount, bool isStatic) { if (isStatic) { var maxPage = ListInfo.MaxPage; if (maxPage == 0) { maxPage = _pageInfo.SiteInfo.Additional.CreateStaticMaxPage; } if (maxPage > 0 && currentPageIndex + 1 > maxPage) { return(ParseDynamic(totalNum, currentPageIndex, pageCount)); } } var parsedContent = string.Empty; _contextInfo.PageItemIndex = currentPageIndex * ListInfo.PageNum; try { if (_node != null) { if (!string.IsNullOrEmpty(SqlString)) { //var pageSqlString = DataProvider.DatabaseDao.GetPageSqlString(SqlString, ListInfo.OrderByString, totalNum, ListInfo.PageNum, currentPageIndex); var pageSqlString = Database.GetStlPageSqlString(SqlString, ListInfo.OrderByString, totalNum, ListInfo.PageNum, currentPageIndex); var datasource = DataProvider.DatabaseDao.GetDataSource(pageSqlString); if (ListInfo.Layout == ELayout.None) { var rptContents = new Repeater(); if (!string.IsNullOrEmpty(ListInfo.HeaderTemplate)) { rptContents.HeaderTemplate = new SeparatorTemplate(ListInfo.HeaderTemplate); } if (!string.IsNullOrEmpty(ListInfo.FooterTemplate)) { rptContents.FooterTemplate = new SeparatorTemplate(ListInfo.FooterTemplate); } if (!string.IsNullOrEmpty(ListInfo.SeparatorTemplate)) { rptContents.SeparatorTemplate = new SeparatorTemplate(ListInfo.SeparatorTemplate); } if (!string.IsNullOrEmpty(ListInfo.AlternatingItemTemplate)) { rptContents.AlternatingItemTemplate = new RepeaterTemplate(ListInfo.AlternatingItemTemplate, ListInfo.SelectedItems, ListInfo.SelectedValues, ListInfo.SeparatorRepeatTemplate, ListInfo.SeparatorRepeat, _pageInfo, EContextType.Content, _contextInfo); } rptContents.ItemTemplate = new RepeaterTemplate(ListInfo.ItemTemplate, ListInfo.SelectedItems, ListInfo.SelectedValues, ListInfo.SeparatorRepeatTemplate, ListInfo.SeparatorRepeat, _pageInfo, EContextType.Content, _contextInfo); rptContents.DataSource = datasource; rptContents.DataBind(); if (rptContents.Items.Count > 0) { parsedContent = ControlUtils.GetControlRenderHtml(rptContents); } } else { var pdlContents = new ParsedDataList(); //设置显示属性 TemplateUtility.PutListInfoToMyDataList(pdlContents, ListInfo); pdlContents.ItemTemplate = new DataListTemplate(ListInfo.ItemTemplate, ListInfo.SelectedItems, ListInfo.SelectedValues, ListInfo.SeparatorRepeatTemplate, ListInfo.SeparatorRepeat, _pageInfo, EContextType.Content, _contextInfo); if (!string.IsNullOrEmpty(ListInfo.HeaderTemplate)) { pdlContents.HeaderTemplate = new SeparatorTemplate(ListInfo.HeaderTemplate); } if (!string.IsNullOrEmpty(ListInfo.FooterTemplate)) { pdlContents.FooterTemplate = new SeparatorTemplate(ListInfo.FooterTemplate); } if (!string.IsNullOrEmpty(ListInfo.SeparatorTemplate)) { pdlContents.SeparatorTemplate = new SeparatorTemplate(ListInfo.SeparatorTemplate); } if (!string.IsNullOrEmpty(ListInfo.AlternatingItemTemplate)) { pdlContents.AlternatingItemTemplate = new DataListTemplate(ListInfo.AlternatingItemTemplate, ListInfo.SelectedItems, ListInfo.SelectedValues, ListInfo.SeparatorRepeatTemplate, ListInfo.SeparatorRepeat, _pageInfo, EContextType.Content, _contextInfo); } pdlContents.DataSource = datasource; pdlContents.DataKeyField = ContentAttribute.Id; pdlContents.DataBind(); if (pdlContents.Items.Count > 0) { parsedContent = ControlUtils.GetControlRenderHtml(pdlContents); } } } } } catch (Exception ex) { parsedContent = StlParserUtility.GetStlErrorMessage(ElementName, _stlPageContentsElement, ex); } parsedContent = StlParserUtility.GetBackHtml(parsedContent, _pageInfo); //还原翻页为0,使得其他列表能够正确解析ItemIndex _contextInfo.PageItemIndex = 0; return(parsedContent); }
private static string ParseElement(PageInfo pageInfo, ContextInfo contextInfo, ListInfo listInfo, DataSet dataSource) { var parsedContent = string.Empty; if (listInfo.Layout == ELayout.None) { var rptContents = new Repeater { ItemTemplate = new RepeaterTemplate(listInfo.ItemTemplate, listInfo.SelectedItems, listInfo.SelectedValues, listInfo.SeparatorRepeatTemplate, listInfo.SeparatorRepeat, pageInfo, EContextType.Content, contextInfo) }; if (!string.IsNullOrEmpty(listInfo.HeaderTemplate)) { rptContents.HeaderTemplate = new SeparatorTemplate(listInfo.HeaderTemplate); } if (!string.IsNullOrEmpty(listInfo.FooterTemplate)) { rptContents.FooterTemplate = new SeparatorTemplate(listInfo.FooterTemplate); } if (!string.IsNullOrEmpty(listInfo.SeparatorTemplate)) { rptContents.SeparatorTemplate = new SeparatorTemplate(listInfo.SeparatorTemplate); } if (!string.IsNullOrEmpty(listInfo.AlternatingItemTemplate)) { rptContents.AlternatingItemTemplate = new RepeaterTemplate(listInfo.AlternatingItemTemplate, listInfo.SelectedItems, listInfo.SelectedValues, listInfo.SeparatorRepeatTemplate, listInfo.SeparatorRepeat, pageInfo, EContextType.Content, contextInfo); } rptContents.DataSource = dataSource; rptContents.DataBind(); if (rptContents.Items.Count > 0) { parsedContent = ControlUtils.GetControlRenderHtml(rptContents); } } else { var pdlContents = new ParsedDataList(); TemplateUtility.PutListInfoToMyDataList(pdlContents, listInfo); pdlContents.ItemTemplate = new DataListTemplate(listInfo.ItemTemplate, listInfo.SelectedItems, listInfo.SelectedValues, listInfo.SeparatorRepeatTemplate, listInfo.SeparatorRepeat, pageInfo, EContextType.Content, contextInfo); if (!string.IsNullOrEmpty(listInfo.HeaderTemplate)) { pdlContents.HeaderTemplate = new SeparatorTemplate(listInfo.HeaderTemplate); } if (!string.IsNullOrEmpty(listInfo.FooterTemplate)) { pdlContents.FooterTemplate = new SeparatorTemplate(listInfo.FooterTemplate); } if (!string.IsNullOrEmpty(listInfo.SeparatorTemplate)) { pdlContents.SeparatorTemplate = new SeparatorTemplate(listInfo.SeparatorTemplate); } if (!string.IsNullOrEmpty(listInfo.AlternatingItemTemplate)) { pdlContents.AlternatingItemTemplate = new DataListTemplate(listInfo.AlternatingItemTemplate, listInfo.SelectedItems, listInfo.SelectedValues, listInfo.SeparatorRepeatTemplate, listInfo.SeparatorRepeat, pageInfo, EContextType.Content, contextInfo); } pdlContents.DataSource = dataSource; pdlContents.DataKeyField = ContentAttribute.Id; pdlContents.DataBind(); if (pdlContents.Items.Count > 0) { parsedContent = ControlUtils.GetControlRenderHtml(pdlContents); } } return(parsedContent); }
private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, ListInfo listInfo) { var parsedContent = string.Empty; if (listInfo.Layout == ELayout.None) { var rptContents = new Repeater { ItemTemplate = new RepeaterTemplate(listInfo.ItemTemplate, listInfo.SelectedItems, listInfo.SelectedValues, listInfo.SeparatorRepeatTemplate, listInfo.SeparatorRepeat, pageInfo, EContextType.SqlContent, contextInfo) }; if (!string.IsNullOrEmpty(listInfo.HeaderTemplate)) { rptContents.HeaderTemplate = new SeparatorTemplate(listInfo.HeaderTemplate); } if (!string.IsNullOrEmpty(listInfo.FooterTemplate)) { rptContents.FooterTemplate = new SeparatorTemplate(listInfo.FooterTemplate); } if (!string.IsNullOrEmpty(listInfo.SeparatorTemplate)) { rptContents.SeparatorTemplate = new SeparatorTemplate(listInfo.SeparatorTemplate); } if (!string.IsNullOrEmpty(listInfo.AlternatingItemTemplate)) { rptContents.AlternatingItemTemplate = new RepeaterTemplate(listInfo.AlternatingItemTemplate, listInfo.SelectedItems, listInfo.SelectedValues, listInfo.SeparatorRepeatTemplate, listInfo.SeparatorRepeat, pageInfo, EContextType.SqlContent, contextInfo); } rptContents.DataSource = StlDataUtility.GetSqlContentsDataSource(listInfo.ConnectionString, listInfo.QueryString, listInfo.StartNum, listInfo.TotalNum, listInfo.OrderByString); rptContents.DataBind(); if (rptContents.Items.Count > 0) { parsedContent = ControlUtils.GetControlRenderHtml(rptContents); } } else { var pdlContents = new ParsedDataList(); TemplateUtility.PutListInfoToMyDataList(pdlContents, listInfo); pdlContents.ItemTemplate = new DataListTemplate(listInfo.ItemTemplate, listInfo.SelectedItems, listInfo.SelectedValues, listInfo.SeparatorRepeatTemplate, listInfo.SeparatorRepeat, pageInfo, EContextType.SqlContent, contextInfo); if (!string.IsNullOrEmpty(listInfo.HeaderTemplate)) { pdlContents.HeaderTemplate = new SeparatorTemplate(listInfo.HeaderTemplate); } if (!string.IsNullOrEmpty(listInfo.FooterTemplate)) { pdlContents.FooterTemplate = new SeparatorTemplate(listInfo.FooterTemplate); } if (!string.IsNullOrEmpty(listInfo.SeparatorTemplate)) { pdlContents.SeparatorTemplate = new SeparatorTemplate(listInfo.SeparatorTemplate); } if (!string.IsNullOrEmpty(listInfo.AlternatingItemTemplate)) { pdlContents.AlternatingItemTemplate = new DataListTemplate(listInfo.AlternatingItemTemplate, listInfo.SelectedItems, listInfo.SelectedValues, listInfo.SeparatorRepeatTemplate, listInfo.SeparatorRepeat, pageInfo, EContextType.SqlContent, contextInfo); } pdlContents.DataSource = StlDataUtility.GetSqlContentsDataSource(listInfo.ConnectionString, listInfo.QueryString, listInfo.StartNum, listInfo.TotalNum, listInfo.OrderByString); pdlContents.DataBind(); if (pdlContents.Items.Count > 0) { parsedContent = ControlUtils.GetControlRenderHtml(pdlContents); } } return(parsedContent); }
public string Parse(int currentPageIndex, int pageCount) { var parsedContent = string.Empty; contextInfo.PageItemIndex = currentPageIndex * displayInfo.PageNum; try { if (node != null) { if (dataSet != null) { var objPage = new PagedDataSource();//分页类 objPage.DataSource = dataSet.Tables[0].DefaultView; if (pageCount > 1) { objPage.AllowPaging = true; objPage.PageSize = displayInfo.PageNum;//每页显示的项数 } else { objPage.AllowPaging = false; } objPage.CurrentPageIndex = currentPageIndex;//当前页的索引 if (displayInfo.Layout == ELayout.None) { var rptContents = new Repeater(); rptContents.ItemTemplate = new RepeaterTemplate(displayInfo.ItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Comment, contextInfo); if (!string.IsNullOrEmpty(displayInfo.HeaderTemplate)) { rptContents.HeaderTemplate = new SeparatorTemplate(displayInfo.HeaderTemplate); } if (!string.IsNullOrEmpty(displayInfo.FooterTemplate)) { rptContents.FooterTemplate = new SeparatorTemplate(displayInfo.FooterTemplate); } if (!string.IsNullOrEmpty(displayInfo.SeparatorTemplate)) { rptContents.SeparatorTemplate = new SeparatorTemplate(displayInfo.SeparatorTemplate); } if (!string.IsNullOrEmpty(displayInfo.AlternatingItemTemplate)) { rptContents.AlternatingItemTemplate = new RepeaterTemplate(displayInfo.AlternatingItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Comment, contextInfo); } rptContents.DataSource = objPage; rptContents.DataBind(); if (rptContents.Items.Count > 0) { parsedContent = ControlUtils.GetControlRenderHtml(rptContents); } } else { var pdlContents = new ParsedDataList(); //设置显示属性 TemplateUtility.PutContentsDisplayInfoToMyDataList(pdlContents, displayInfo); //设置列表模板 pdlContents.ItemTemplate = new DataListTemplate(displayInfo.ItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Comment, contextInfo); if (!string.IsNullOrEmpty(displayInfo.HeaderTemplate)) { pdlContents.HeaderTemplate = new SeparatorTemplate(displayInfo.HeaderTemplate); } if (!string.IsNullOrEmpty(displayInfo.FooterTemplate)) { pdlContents.FooterTemplate = new SeparatorTemplate(displayInfo.FooterTemplate); } if (!string.IsNullOrEmpty(displayInfo.SeparatorTemplate)) { pdlContents.SeparatorTemplate = new SeparatorTemplate(displayInfo.SeparatorTemplate); } if (!string.IsNullOrEmpty(displayInfo.AlternatingItemTemplate)) { pdlContents.AlternatingItemTemplate = new DataListTemplate(displayInfo.AlternatingItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Comment, contextInfo); } pdlContents.DataSource = objPage; pdlContents.DataBind(); if (pdlContents.Items.Count > 0) { parsedContent = ControlUtils.GetControlRenderHtml(pdlContents); } } } } } catch (Exception ex) { parsedContent = StlParserUtility.GetStlErrorMessage(ElementName, ex); } //还原翻页为0,使得其他列表能够正确解析ItemIndex contextInfo.PageItemIndex = 0; return(parsedContent); }
private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, ListInfo listInfo) { var parsedContent = string.Empty; if (listInfo.Layout == ELayout.None) { var rptContents = new Repeater(); if (!string.IsNullOrEmpty(listInfo.HeaderTemplate)) { rptContents.HeaderTemplate = new SeparatorTemplate(listInfo.HeaderTemplate); } if (!string.IsNullOrEmpty(listInfo.FooterTemplate)) { rptContents.FooterTemplate = new SeparatorTemplate(listInfo.FooterTemplate); } if (!string.IsNullOrEmpty(listInfo.SeparatorTemplate)) { rptContents.SeparatorTemplate = new SeparatorTemplate(listInfo.SeparatorTemplate); } if (!string.IsNullOrEmpty(listInfo.AlternatingItemTemplate)) { rptContents.AlternatingItemTemplate = new RepeaterTemplate(listInfo.AlternatingItemTemplate, null, null, listInfo.SeparatorRepeatTemplate, listInfo.SeparatorRepeat, pageInfo, EContextType.Comment, contextInfo); } rptContents.ItemTemplate = new RepeaterTemplate(listInfo.ItemTemplate, null, null, listInfo.SeparatorRepeatTemplate, listInfo.SeparatorRepeat, pageInfo, EContextType.Comment, contextInfo); rptContents.DataSource = StlDataUtility.GetCommentsDataSource(pageInfo.PublishmentSystemId, contextInfo.ChannelId, contextInfo.ContentId, contextInfo.ItemContainer, listInfo.StartNum, listInfo.TotalNum, listInfo.IsRecommend, listInfo.OrderByString, listInfo.Where); rptContents.DataBind(); if (rptContents.Items.Count > 0) { parsedContent = ControlUtils.GetControlRenderHtml(rptContents); } } else { var pdlContents = new ParsedDataList(); TemplateUtility.PutListInfoToMyDataList(pdlContents, listInfo); pdlContents.ItemTemplate = new DataListTemplate(listInfo.ItemTemplate, null, null, listInfo.SeparatorRepeatTemplate, listInfo.SeparatorRepeat, pageInfo, EContextType.Comment, contextInfo); if (!string.IsNullOrEmpty(listInfo.HeaderTemplate)) { pdlContents.HeaderTemplate = new SeparatorTemplate(listInfo.HeaderTemplate); } if (!string.IsNullOrEmpty(listInfo.FooterTemplate)) { pdlContents.FooterTemplate = new SeparatorTemplate(listInfo.FooterTemplate); } if (!string.IsNullOrEmpty(listInfo.SeparatorTemplate)) { pdlContents.SeparatorTemplate = new SeparatorTemplate(listInfo.SeparatorTemplate); } if (!string.IsNullOrEmpty(listInfo.AlternatingItemTemplate)) { pdlContents.AlternatingItemTemplate = new DataListTemplate(listInfo.AlternatingItemTemplate, null, null, listInfo.SeparatorRepeatTemplate, listInfo.SeparatorRepeat, pageInfo, EContextType.Comment, contextInfo); } pdlContents.DataSource = StlDataUtility.GetCommentsDataSource(pageInfo.PublishmentSystemId, contextInfo.ChannelId, contextInfo.ContentId, contextInfo.ItemContainer, listInfo.StartNum, listInfo.TotalNum, listInfo.IsRecommend, listInfo.OrderByString, listInfo.Where); pdlContents.DataBind(); if (pdlContents.Items.Count > 0) { parsedContent = ControlUtils.GetControlRenderHtml(pdlContents); } } return(parsedContent); }
private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, ContentsDisplayInfo displayInfo) { var parsedContent = string.Empty; var titleWordNum = contextInfo.TitleWordNum; contextInfo.TitleWordNum = displayInfo.TitleWordNum; var dataSource = GetDataSource(pageInfo, contextInfo, displayInfo); if (displayInfo.Layout == ELayout.None) { var rptContents = new Repeater(); rptContents.ItemTemplate = new RepeaterTemplate(displayInfo.ItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Content, contextInfo); if (!string.IsNullOrEmpty(displayInfo.HeaderTemplate)) { rptContents.HeaderTemplate = new SeparatorTemplate(displayInfo.HeaderTemplate); } if (!string.IsNullOrEmpty(displayInfo.FooterTemplate)) { rptContents.FooterTemplate = new SeparatorTemplate(displayInfo.FooterTemplate); } if (!string.IsNullOrEmpty(displayInfo.SeparatorTemplate)) { rptContents.SeparatorTemplate = new SeparatorTemplate(displayInfo.SeparatorTemplate); } if (!string.IsNullOrEmpty(displayInfo.AlternatingItemTemplate)) { rptContents.AlternatingItemTemplate = new RepeaterTemplate(displayInfo.AlternatingItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Content, contextInfo); } rptContents.DataSource = dataSource; rptContents.DataBind(); if (rptContents.Items.Count > 0) { parsedContent = ControlUtils.GetControlRenderHtml(rptContents); } } else { var pdlContents = new ParsedDataList(); TemplateUtility.PutContentsDisplayInfoToMyDataList(pdlContents, displayInfo); pdlContents.ItemTemplate = new DataListTemplate(displayInfo.ItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Content, contextInfo); if (!string.IsNullOrEmpty(displayInfo.HeaderTemplate)) { pdlContents.HeaderTemplate = new SeparatorTemplate(displayInfo.HeaderTemplate); } if (!string.IsNullOrEmpty(displayInfo.FooterTemplate)) { pdlContents.FooterTemplate = new SeparatorTemplate(displayInfo.FooterTemplate); } if (!string.IsNullOrEmpty(displayInfo.SeparatorTemplate)) { pdlContents.SeparatorTemplate = new SeparatorTemplate(displayInfo.SeparatorTemplate); } if (!string.IsNullOrEmpty(displayInfo.AlternatingItemTemplate)) { pdlContents.AlternatingItemTemplate = new DataListTemplate(displayInfo.AlternatingItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Content, contextInfo); } pdlContents.DataSource = dataSource; pdlContents.DataKeyField = ContentAttribute.Id; pdlContents.DataBind(); if (pdlContents.Items.Count > 0) { parsedContent = ControlUtils.GetControlRenderHtml(pdlContents); } } contextInfo.TitleWordNum = titleWordNum; return(parsedContent); }
//public int GetPageCount(out int contentNum) //{ // var pageCount = 1; // contentNum = 0;//数据库中实际的内容数目 // if (_dataSet == null) return pageCount; // contentNum = _dataSet.Tables[0].DefaultView.Count; // if (_listInfo.PageNum != 0 && _listInfo.PageNum < contentNum)//需要翻页 // { // pageCount = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(contentNum) / Convert.ToDouble(_listInfo.PageNum)));//需要生成的总页数 // } // return pageCount; //} public string Parse(int totalNum, int currentPageIndex, int pageCount, bool isStatic) { if (isStatic) { var maxPage = _listInfo.MaxPage; if (maxPage == 0) { maxPage = _pageInfo.SiteInfo.Additional.CreateStaticMaxPage; } if (maxPage > 0 && currentPageIndex + 1 > maxPage) { return(ParseDynamic(totalNum, currentPageIndex, pageCount)); } } var parsedContent = string.Empty; _contextInfo.PageItemIndex = currentPageIndex * _listInfo.PageNum; try { if (!string.IsNullOrEmpty(_sqlString)) { //var pageSqlString = DatabaseApi.Instance.GetPageSqlString(SqlString, ListInfo.OrderByString, totalNum, ListInfo.PageNum, currentPageIndex); var pageSqlString = StlDatabaseCache.GetStlPageSqlString(_sqlString, _listInfo.OrderByString, totalNum, _listInfo.PageNum, currentPageIndex); var dataSource = DataProvider.DatabaseDao.GetDataSource(pageSqlString); if (_listInfo.Layout == ELayout.None) { var rptContents = new Repeater(); if (!string.IsNullOrEmpty(_listInfo.HeaderTemplate)) { rptContents.HeaderTemplate = new SeparatorTemplate(_listInfo.HeaderTemplate); } if (!string.IsNullOrEmpty(_listInfo.FooterTemplate)) { rptContents.FooterTemplate = new SeparatorTemplate(_listInfo.FooterTemplate); } if (!string.IsNullOrEmpty(_listInfo.SeparatorTemplate)) { rptContents.SeparatorTemplate = new SeparatorTemplate(_listInfo.SeparatorTemplate); } if (!string.IsNullOrEmpty(_listInfo.AlternatingItemTemplate)) { rptContents.AlternatingItemTemplate = new RepeaterTemplate(_listInfo.AlternatingItemTemplate, _listInfo.SelectedItems, _listInfo.SelectedValues, _listInfo.SeparatorRepeatTemplate, _listInfo.SeparatorRepeat, _pageInfo, EContextType.SqlContent, _contextInfo); } rptContents.ItemTemplate = new RepeaterTemplate(_listInfo.ItemTemplate, _listInfo.SelectedItems, _listInfo.SelectedValues, _listInfo.SeparatorRepeatTemplate, _listInfo.SeparatorRepeat, _pageInfo, EContextType.SqlContent, _contextInfo); rptContents.DataSource = dataSource; rptContents.DataBind(); if (rptContents.Items.Count > 0) { parsedContent = ControlUtils.GetControlRenderHtml(rptContents); } } else { var pdlContents = new ParsedDataList(); //设置显示属性 TemplateUtility.PutListInfoToMyDataList(pdlContents, _listInfo); pdlContents.ItemTemplate = new DataListTemplate(_listInfo.ItemTemplate, _listInfo.SelectedItems, _listInfo.SelectedValues, _listInfo.SeparatorRepeatTemplate, _listInfo.SeparatorRepeat, _pageInfo, EContextType.SqlContent, _contextInfo); if (!string.IsNullOrEmpty(_listInfo.HeaderTemplate)) { pdlContents.HeaderTemplate = new SeparatorTemplate(_listInfo.HeaderTemplate); } if (!string.IsNullOrEmpty(_listInfo.FooterTemplate)) { pdlContents.FooterTemplate = new SeparatorTemplate(_listInfo.FooterTemplate); } if (!string.IsNullOrEmpty(_listInfo.SeparatorTemplate)) { pdlContents.SeparatorTemplate = new SeparatorTemplate(_listInfo.SeparatorTemplate); } if (!string.IsNullOrEmpty(_listInfo.AlternatingItemTemplate)) { pdlContents.AlternatingItemTemplate = new DataListTemplate(_listInfo.AlternatingItemTemplate, _listInfo.SelectedItems, _listInfo.SelectedValues, _listInfo.SeparatorRepeatTemplate, _listInfo.SeparatorRepeat, _pageInfo, EContextType.SqlContent, _contextInfo); } pdlContents.DataSource = dataSource; pdlContents.DataKeyField = ContentAttribute.Id; pdlContents.DataBind(); if (pdlContents.Items.Count > 0) { parsedContent = ControlUtils.GetControlRenderHtml(pdlContents); } } } //if (_dataSet != null) //{ // var dataSource = new PagedDataSource { DataSource = _dataSet.Tables[0].DefaultView }; //分页类 // if (pageCount > 1) // { // dataSource.AllowPaging = true; // dataSource.PageSize = _listInfo.PageNum;//每页显示的项数 // } // else // { // dataSource.AllowPaging = false; // } // dataSource.CurrentPageIndex = currentPageIndex;//当前页的索引 // if (_listInfo.Layout == ELayout.None) // { // var rptContents = new Repeater // { // ItemTemplate = // new RepeaterTemplate(_listInfo.ItemTemplate, _listInfo.SelectedItems, // _listInfo.SelectedValues, _listInfo.SeparatorRepeatTemplate, // _listInfo.SeparatorRepeat, _pageInfo, EContextType.SqlContent, _contextInfo) // }; // if (!string.IsNullOrEmpty(_listInfo.HeaderTemplate)) // { // rptContents.HeaderTemplate = new SeparatorTemplate(_listInfo.HeaderTemplate); // } // if (!string.IsNullOrEmpty(_listInfo.FooterTemplate)) // { // rptContents.FooterTemplate = new SeparatorTemplate(_listInfo.FooterTemplate); // } // if (!string.IsNullOrEmpty(_listInfo.SeparatorTemplate)) // { // rptContents.SeparatorTemplate = new SeparatorTemplate(_listInfo.SeparatorTemplate); // } // if (!string.IsNullOrEmpty(_listInfo.AlternatingItemTemplate)) // { // rptContents.AlternatingItemTemplate = new RepeaterTemplate(_listInfo.AlternatingItemTemplate, _listInfo.SelectedItems, _listInfo.SelectedValues, _listInfo.SeparatorRepeatTemplate, _listInfo.SeparatorRepeat, _pageInfo, EContextType.SqlContent, _contextInfo); // } // rptContents.DataSource = dataSource; // rptContents.DataBind(); // if (rptContents.Items.Count > 0) // { // parsedContent = ControlUtils.GetControlRenderHtml(rptContents); // } // } // else // { // var pdlContents = new ParsedDataList(); // //设置显示属性 // TemplateUtility.PutListInfoToMyDataList(pdlContents, _listInfo); // pdlContents.ItemTemplate = new DataListTemplate(_listInfo.ItemTemplate, _listInfo.SelectedItems, _listInfo.SelectedValues, _listInfo.SeparatorRepeatTemplate, _listInfo.SeparatorRepeat, _pageInfo, EContextType.SqlContent, _contextInfo); // if (!string.IsNullOrEmpty(_listInfo.HeaderTemplate)) // { // pdlContents.HeaderTemplate = new SeparatorTemplate(_listInfo.HeaderTemplate); // } // if (!string.IsNullOrEmpty(_listInfo.FooterTemplate)) // { // pdlContents.FooterTemplate = new SeparatorTemplate(_listInfo.FooterTemplate); // } // if (!string.IsNullOrEmpty(_listInfo.SeparatorTemplate)) // { // pdlContents.SeparatorTemplate = new SeparatorTemplate(_listInfo.SeparatorTemplate); // } // if (!string.IsNullOrEmpty(_listInfo.AlternatingItemTemplate)) // { // pdlContents.AlternatingItemTemplate = new DataListTemplate(_listInfo.AlternatingItemTemplate, _listInfo.SelectedItems, _listInfo.SelectedValues, _listInfo.SeparatorRepeatTemplate, _listInfo.SeparatorRepeat, _pageInfo, EContextType.SqlContent, _contextInfo); // } // pdlContents.DataSource = dataSource; // pdlContents.DataBind(); // if (pdlContents.Items.Count > 0) // { // parsedContent = ControlUtils.GetControlRenderHtml(pdlContents); // } // } //} } catch (Exception ex) { parsedContent = LogUtils.AddStlErrorLog(_pageInfo, ElementName, _stlPageSqlContentsElement, ex); } //还原翻页为0,使得其他列表能够正确解析ItemIndex _contextInfo.PageItemIndex = 0; return(parsedContent); }
private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, ContentsDisplayInfo displayInfo) { var parsedContent = string.Empty; contextInfo.TitleWordNum = 0; var siteName = displayInfo.OtherAttributes[Attribute_SiteName]; var directory = displayInfo.OtherAttributes[Attribute_Directory]; var since = displayInfo.OtherAttributes[Attribute_Since]; if (displayInfo.Layout == ELayout.None) { var rptContents = new Repeater(); rptContents.ItemTemplate = new RepeaterTemplate(displayInfo.ItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Site, contextInfo); if (!string.IsNullOrEmpty(displayInfo.HeaderTemplate)) { rptContents.HeaderTemplate = new SeparatorTemplate(displayInfo.HeaderTemplate); } if (!string.IsNullOrEmpty(displayInfo.FooterTemplate)) { rptContents.FooterTemplate = new SeparatorTemplate(displayInfo.FooterTemplate); } if (!string.IsNullOrEmpty(displayInfo.SeparatorTemplate)) { rptContents.SeparatorTemplate = new SeparatorTemplate(displayInfo.SeparatorTemplate); } if (!string.IsNullOrEmpty(displayInfo.AlternatingItemTemplate)) { rptContents.AlternatingItemTemplate = new RepeaterTemplate(displayInfo.AlternatingItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Site, contextInfo); } rptContents.DataSource = StlDataUtility.GetSitesDataSource(siteName, directory, displayInfo.StartNum, displayInfo.TotalNum, displayInfo.Where, displayInfo.Scope, displayInfo.OrderByString, since); rptContents.DataBind(); if (rptContents.Items.Count > 0) { parsedContent = ControlUtils.GetControlRenderHtml(rptContents); } } else { var pdlContents = new ParsedDataList(); TemplateUtility.PutContentsDisplayInfoToMyDataList(pdlContents, displayInfo); pdlContents.ItemTemplate = new DataListTemplate(displayInfo.ItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Site, contextInfo); if (!string.IsNullOrEmpty(displayInfo.HeaderTemplate)) { pdlContents.HeaderTemplate = new SeparatorTemplate(displayInfo.HeaderTemplate); } if (!string.IsNullOrEmpty(displayInfo.FooterTemplate)) { pdlContents.FooterTemplate = new SeparatorTemplate(displayInfo.FooterTemplate); } if (!string.IsNullOrEmpty(displayInfo.SeparatorTemplate)) { pdlContents.SeparatorTemplate = new SeparatorTemplate(displayInfo.SeparatorTemplate); } if (!string.IsNullOrEmpty(displayInfo.AlternatingItemTemplate)) { pdlContents.AlternatingItemTemplate = new DataListTemplate(displayInfo.AlternatingItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Site, contextInfo); } pdlContents.DataSource = StlDataUtility.GetSitesDataSource(siteName, directory, displayInfo.StartNum, displayInfo.TotalNum, displayInfo.Where, displayInfo.Scope, displayInfo.OrderByString, since); pdlContents.DataBind(); if (pdlContents.Items.Count > 0) { parsedContent = ControlUtils.GetControlRenderHtml(pdlContents); } } return(parsedContent); }
private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, ListInfo listInfo) { var parsedContent = string.Empty; contextInfo.TitleWordNum = 0; var inputId = DataProvider.InputDao.GetInputIdAsPossible(listInfo.Others.Get(AttributeInputName), pageInfo.PublishmentSystemId); if (listInfo.Layout == ELayout.None) { var rptContents = new Repeater { ItemTemplate = new RepeaterTemplate(listInfo.ItemTemplate, null, null, listInfo.SeparatorRepeatTemplate, listInfo.SeparatorRepeat, pageInfo, EContextType.InputContent, contextInfo) }; if (!string.IsNullOrEmpty(listInfo.HeaderTemplate)) { rptContents.HeaderTemplate = new SeparatorTemplate(listInfo.HeaderTemplate); } if (!string.IsNullOrEmpty(listInfo.FooterTemplate)) { rptContents.FooterTemplate = new SeparatorTemplate(listInfo.FooterTemplate); } if (!string.IsNullOrEmpty(listInfo.SeparatorTemplate)) { rptContents.SeparatorTemplate = new SeparatorTemplate(listInfo.SeparatorTemplate); } if (!string.IsNullOrEmpty(listInfo.AlternatingItemTemplate)) { rptContents.AlternatingItemTemplate = new RepeaterTemplate(listInfo.AlternatingItemTemplate, null, null, listInfo.SeparatorRepeatTemplate, listInfo.SeparatorRepeat, pageInfo, EContextType.InputContent, contextInfo); } rptContents.DataSource = StlDataUtility.GetInputContentsDataSource(pageInfo.PublishmentSystemId, inputId, listInfo); rptContents.DataBind(); if (rptContents.Items.Count > 0) { parsedContent = ControlUtils.GetControlRenderHtml(rptContents); } } else { var pdlContents = new ParsedDataList(); TemplateUtility.PutListInfoToMyDataList(pdlContents, listInfo); pdlContents.ItemTemplate = new DataListTemplate(listInfo.ItemTemplate, null, null, listInfo.SeparatorRepeatTemplate, listInfo.SeparatorRepeat, pageInfo, EContextType.InputContent, contextInfo); if (!string.IsNullOrEmpty(listInfo.HeaderTemplate)) { pdlContents.HeaderTemplate = new SeparatorTemplate(listInfo.HeaderTemplate); } if (!string.IsNullOrEmpty(listInfo.FooterTemplate)) { pdlContents.FooterTemplate = new SeparatorTemplate(listInfo.FooterTemplate); } if (!string.IsNullOrEmpty(listInfo.SeparatorTemplate)) { pdlContents.SeparatorTemplate = new SeparatorTemplate(listInfo.SeparatorTemplate); } if (!string.IsNullOrEmpty(listInfo.AlternatingItemTemplate)) { pdlContents.AlternatingItemTemplate = new DataListTemplate(listInfo.AlternatingItemTemplate, null, null, listInfo.SeparatorRepeatTemplate, listInfo.SeparatorRepeat, pageInfo, EContextType.InputContent, contextInfo); } pdlContents.DataSource = StlDataUtility.GetInputContentsDataSource(pageInfo.PublishmentSystemId, inputId, listInfo); pdlContents.DataBind(); if (pdlContents.Items.Count > 0) { parsedContent = ControlUtils.GetControlRenderHtml(pdlContents); } } return(parsedContent); }
public string Parse(int currentPageIndex, int pageCount) { var parsedContent = string.Empty; _contextInfo.PageItemIndex = currentPageIndex * DisplayInfo.PageNum; try { if (_dataSet != null) { var objPage = new PagedDataSource { DataSource = _dataSet.Tables[0].DefaultView }; //分页类 if (pageCount > 1) { objPage.AllowPaging = true; objPage.PageSize = DisplayInfo.PageNum;//每页显示的项数 } else { objPage.AllowPaging = false; } objPage.CurrentPageIndex = currentPageIndex;//当前页的索引 if (DisplayInfo.Layout == ELayout.None) { var rptContents = new Repeater { ItemTemplate = new RepeaterTemplate(DisplayInfo.ItemTemplate, DisplayInfo.SelectedItems, DisplayInfo.SelectedValues, DisplayInfo.SeparatorRepeatTemplate, DisplayInfo.SeparatorRepeat, _pageInfo, EContextType.Channel, _contextInfo) }; if (!string.IsNullOrEmpty(DisplayInfo.HeaderTemplate)) { rptContents.HeaderTemplate = new SeparatorTemplate(DisplayInfo.HeaderTemplate); } if (!string.IsNullOrEmpty(DisplayInfo.FooterTemplate)) { rptContents.FooterTemplate = new SeparatorTemplate(DisplayInfo.FooterTemplate); } if (!string.IsNullOrEmpty(DisplayInfo.SeparatorTemplate)) { rptContents.SeparatorTemplate = new SeparatorTemplate(DisplayInfo.SeparatorTemplate); } if (!string.IsNullOrEmpty(DisplayInfo.AlternatingItemTemplate)) { rptContents.AlternatingItemTemplate = new RepeaterTemplate(DisplayInfo.AlternatingItemTemplate, DisplayInfo.SelectedItems, DisplayInfo.SelectedValues, DisplayInfo.SeparatorRepeatTemplate, DisplayInfo.SeparatorRepeat, _pageInfo, EContextType.Channel, _contextInfo); } rptContents.DataSource = objPage; rptContents.DataBind(); if (rptContents.Items.Count > 0) { parsedContent = ControlUtils.GetControlRenderHtml(rptContents); } } else { var pdlContents = new ParsedDataList(); //设置显示属性 TemplateUtility.PutListInfoToMyDataList(pdlContents, DisplayInfo); //设置列表模板 pdlContents.ItemTemplate = new DataListTemplate(DisplayInfo.ItemTemplate, DisplayInfo.SelectedItems, DisplayInfo.SelectedValues, DisplayInfo.SeparatorRepeatTemplate, DisplayInfo.SeparatorRepeat, _pageInfo, EContextType.Channel, _contextInfo); if (!string.IsNullOrEmpty(DisplayInfo.HeaderTemplate)) { pdlContents.HeaderTemplate = new SeparatorTemplate(DisplayInfo.HeaderTemplate); } if (!string.IsNullOrEmpty(DisplayInfo.FooterTemplate)) { pdlContents.FooterTemplate = new SeparatorTemplate(DisplayInfo.FooterTemplate); } if (!string.IsNullOrEmpty(DisplayInfo.SeparatorTemplate)) { pdlContents.SeparatorTemplate = new SeparatorTemplate(DisplayInfo.SeparatorTemplate); } if (!string.IsNullOrEmpty(DisplayInfo.AlternatingItemTemplate)) { pdlContents.AlternatingItemTemplate = new DataListTemplate(DisplayInfo.AlternatingItemTemplate, DisplayInfo.SelectedItems, DisplayInfo.SelectedValues, DisplayInfo.SeparatorRepeatTemplate, DisplayInfo.SeparatorRepeat, _pageInfo, EContextType.Channel, _contextInfo); } pdlContents.DataSource = objPage; pdlContents.DataKeyField = ChannelAttribute.Id; pdlContents.DataBind(); if (pdlContents.Items.Count > 0) { parsedContent = ControlUtils.GetControlRenderHtml(pdlContents); } } } } catch (Exception ex) { parsedContent = LogUtils.AddStlErrorLog(_pageInfo, ElementName, _stlPageChannelsElement, ex); } //还原翻页为0,使得其他列表能够正确解析ItemIndex _contextInfo.PageItemIndex = 0; return(parsedContent); }
private static string ParseImpl(PageInfo pageInfo, XmlNode node, ContextInfo contextInfo, ContentsDisplayInfo displayInfo) { var parsedContent = string.Empty; var type = displayInfo.OtherAttributes[Attribute_Type]; if (string.IsNullOrEmpty(type)) { type = BackgroundContentAttribute.ImageUrl; } var value = displayInfo.OtherAttributes[Attribute_Value]; var onPreLoad = displayInfo.OtherAttributes[Attribute_OnPreLoad]; var onLoaded = displayInfo.OtherAttributes[Attribute_OnLoaded]; var contextType = EContextType.Each; IEnumerable dataSource = null; if (StringUtils.EqualsIgnoreCase(type, Type_Photo)) { contextType = EContextType.Photo; dataSource = StlDataUtility.GetPhotosDataSource(pageInfo.PublishmentSystemInfo, contextInfo.ContentID, displayInfo.StartNum, displayInfo.TotalNum); } else if (StringUtils.EqualsIgnoreCase(type, Type_Property)) { if (contextInfo.ContextType == EContextType.Undefined) { contextInfo.ContextType = EContextType.Content; } contextType = contextInfo.ContextType; dataSource = StlDataUtility.GetPropertysDataSource(pageInfo.PublishmentSystemInfo, contextInfo.ContentInfo, contextType, value, displayInfo.StartNum, displayInfo.TotalNum); } else if (StringUtils.EqualsIgnoreCase(type, Type_Template)) { var builder = new StringBuilder(node.InnerXml); StlParserManager.ParseInnerContent(builder, pageInfo, contextInfo); return($@" <%for(i = 0; i < {value}.length; i ++) {{ item = {value}[i]; %> {builder} <%}}%> "); } else { var contentInfo = contextInfo.ContentInfo; if (contentInfo != null) { var eachList = new List <string>(); if (!string.IsNullOrEmpty(contentInfo.GetExtendedAttribute(type))) { eachList.Add(contentInfo.GetExtendedAttribute(type)); } var extendAttributeName = ContentAttribute.GetExtendAttributeName(type); var extendValues = contentInfo.GetExtendedAttribute(extendAttributeName); if (!string.IsNullOrEmpty(extendValues)) { foreach (string extendValue in TranslateUtils.StringCollectionToStringList(extendValues)) { eachList.Add(extendValue); } } if (displayInfo.StartNum > 1 || displayInfo.TotalNum > 0) { if (displayInfo.StartNum > 1) { var count = displayInfo.StartNum - 1; if (count > eachList.Count) { count = eachList.Count; } eachList.RemoveRange(0, count); } if (displayInfo.TotalNum > 0) { if (displayInfo.TotalNum < eachList.Count) { eachList.RemoveRange(displayInfo.TotalNum, eachList.Count - displayInfo.TotalNum); } } } dataSource = eachList; } } if (displayInfo.Layout == ELayout.None) { var rptContents = new Repeater(); rptContents.ItemTemplate = new RepeaterTemplate(displayInfo.ItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, contextType, contextInfo); if (!string.IsNullOrEmpty(displayInfo.HeaderTemplate)) { rptContents.HeaderTemplate = new SeparatorTemplate(displayInfo.HeaderTemplate); } if (!string.IsNullOrEmpty(displayInfo.FooterTemplate)) { rptContents.FooterTemplate = new SeparatorTemplate(displayInfo.FooterTemplate); } if (!string.IsNullOrEmpty(displayInfo.SeparatorTemplate)) { rptContents.SeparatorTemplate = new SeparatorTemplate(displayInfo.SeparatorTemplate); } if (!string.IsNullOrEmpty(displayInfo.AlternatingItemTemplate)) { rptContents.AlternatingItemTemplate = new RepeaterTemplate(displayInfo.AlternatingItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, contextType, contextInfo); } rptContents.DataSource = dataSource; rptContents.DataBind(); if (rptContents.Items.Count > 0) { parsedContent = ControlUtils.GetControlRenderHtml(rptContents); } } else { var pdlContents = new ParsedDataList(); TemplateUtility.PutContentsDisplayInfoToMyDataList(pdlContents, displayInfo); pdlContents.ItemTemplate = new DataListTemplate(displayInfo.ItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, contextType, contextInfo); if (!string.IsNullOrEmpty(displayInfo.HeaderTemplate)) { pdlContents.HeaderTemplate = new SeparatorTemplate(displayInfo.HeaderTemplate); } if (!string.IsNullOrEmpty(displayInfo.FooterTemplate)) { pdlContents.FooterTemplate = new SeparatorTemplate(displayInfo.FooterTemplate); } if (!string.IsNullOrEmpty(displayInfo.SeparatorTemplate)) { pdlContents.SeparatorTemplate = new SeparatorTemplate(displayInfo.SeparatorTemplate); } if (!string.IsNullOrEmpty(displayInfo.AlternatingItemTemplate)) { pdlContents.AlternatingItemTemplate = new DataListTemplate(displayInfo.AlternatingItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, contextType, contextInfo); } pdlContents.DataSource = dataSource; pdlContents.DataBind(); if (pdlContents.Items.Count > 0) { parsedContent = ControlUtils.GetControlRenderHtml(pdlContents); } } return(parsedContent); }