破竹CMS
>
帮助文档
>
开发控件介绍
> RelationDocuments
RelationDocuments:查询当前栏目或文档的关联文档
<pz:SearchDocuments runat="server" EnableViewState="false" RelationID="" RelationPath="" ItemsPerRow="" PageIndex="" PageSize="" PagerID="" ReturnCount="false/true" SelectIndex="" ShowHeaderFooterOnNone="">
<LeaderTemplate>
列表输入前的Html模板内容
</LeaderTemplate>
<HeaderTemplate>
列表表头的Html模板内容
</HeaderTemplate>
<ItemTemplate>
列表项的Html模板内容
</ItemTemplate>
<SeparatorTemplate>
列表项(交替项)之间分隔的Html模板内容
</SeparatorTemplate>
<AlternatingItemTemplate>
列表交替项的Html模板内容
</AlternatingItemTemplate>
<RowSeparatorTemplate>
循环ItemsPerRow次数后的Html模板内容
</RowSeparatorTemplate>
<SelectTemplate>
选中项的的Html模板内容
</SelectTemplate>
<NoneTemplate>
列表集合项数为0时的Html模板内容
</NoneTemplate>
<FooterTemplate>
列表表尾的Html模板内容
</FooterTemplate>
<TrailerTemplate>
列表全部输出后的Html模板内容
</TrailerTemplate>
<Where>
查询条件
</Where>
<Sorts>
<pz:Sort SortBy="排序列名" SorOrder="Ascending/Descending" />
......
</Sorts>
<Queries>
<pz:PrefixQuery PropertyDefinitionID="扩展属性ID" QueryKeyWord="查询关键词" Order="false/true" SorOrder="Ascending/Descending" />
<pz:RangeQuery PropertyDefinitionID="扩展属性ID" Lower="最小值" Upper="最大值" Order="false/true" SorOrder="Ascending/Descending" />
<pz:TermQuery PropertyDefinitionID="扩展属性ID" QueryKeyWord="查询关键词" Unequal="不匹配查询" Order="false/true" SorOrder="Ascending/Descending" />
<pz:WildcardQuery PropertyDefinitionID="扩展属性ID" QueryWildcard="查询关键词" Order="false/true" SorOrder="Ascending/Descending" />
</Queries>
</pz:SearchDocuments>
说明:
- 当前文档不为NULL则绑定当前文档的关联文档;
- 如果当前文档为NULL但当前栏目不为NULL则绑定当前栏目的关联文档;
- 如果当前栏目和当前文档均为NULL,该控件不可用;
| 属性名称 |
说明 |
| runat |
指示控件在服务器端运行;值:server;每个控件都必须设置该值 |
| EnableViewState |
是否在客户端保持视图状态;需要向服务器回发时才需要启用;默认值为true;当不需要回发时应设为false,可以提高性能; |
| RelationID |
关联的编号 |
| RelationPath |
关联的栏目路径;当没有设置RelationID的值时此属性才可用;比如在新闻栏目和评论栏目间建立了一个关联,那么RelationPath的值为评论栏目的路径;
|
| PageSize |
指定绑定文档的集合数 |
| PageIndex |
指定绑定文档的页索引 |
| PagerID |
指定分页控件的ID,该分页控件必须是实现Pozhu.UI.WebControls.IPager接口的分布控件; |
| ReturnCount |
是否返回总记录数;为优化需要默认为不返回总记录数,当指定了PagerID时强制返回总记录数; |
| ItemsPerRow |
在栏目集合循环ItemsPerRow次后呈现RowSeparatorTemplate模板数据 |
| SelectIndex |
选中的索引集合项,呈现SeparatorTemplate模板数据 |
| ShowHeaderFooterOnNone |
当栏目集合数为0时,是否显示HeaderTemplate和FooterTemplate模板的数据 |
<where></where>、<Sorts></Sorts>、<Queries></Queries>在SearchDocuments文章中有介绍;
模板说明:
| 模板名称 |
说明 |
| LeaderTemplate |
如果定义,则可以确定列表输出前的内容和布局。如果没有定义,则不呈现 |
| HeaderTemplate |
如果定义,则可以确定列表标头的内容和布局。如果没有定义,则不呈现标头 |
| ItemTemplate |
定义列表中项目的内容和布局。此模板为必选 |
| SeparatorTemplate |
如果定义,则呈现在项(以及交替项)之间。如果未定义,则不呈现分隔符 |
| AlternatingItemTemplate |
如果定义,则可以确定交替(从零开始的奇数索引)项的内容和布局。如果未定义,则使用 ItemTemplate; |
| RowSeparatorTemplate |
如果定义且设定了ItemsPerRow的值,则循环呈现在ItemsPerRow项后; |
| SelectTemplate |
如果定义且设计了SelectIndex的值,则呈现在SelectIndex项 |
| NoneTemplate |
如果定义且当列表集合数为0个时呈现; |
| FooterTemplate |
如果定义,则可以确定列表注脚的内容和布局。如果没有定义,则不呈现注脚 |
| TrailerTemplate |
如果定义,则可以确定列表输出后的内容和布局。如果没有定义,则不呈现 |
模板中绑定的语法:<%# Eval("属性名称")%>绑定扩展属性的语法(有点复杂):<%# ((Document)Container.DataItem).Profile.GetPropertyValue("扩展属性名称")%>
当前文档的关联文档示例:
当前栏目的关联文档示例: