我的文档类型包含字段:图像和文本。我想将webpart添加到带有CMS转发器的kentico,它显示所有文档Product,但我想只显示包含图像的文档(不需要字段图像)。我添加了一行
WhereCondition =“图片不为空”
到cmsrepeater并在我的本地计算机上工作 - 我只能看到有图像的项目。但是,当我将文件移动到分段时,这是一个问题,我可以看到空白的地方应该是一个图像所以我的方法不起作用,但我不知道为什么......任何想法?
我的所有代码:
<cms:CMSRepeater ID="rptProducts" runat="server" Path="/Products/%" ClassNames="Products.Item" TransformationName="Product.ProductList" SelectOnlyPublished="true" StopProcessing="true" PagerControl-PageSize ="4" PagerControl-PageNumbersSeparator="" PagerControl-BackNextStyle="display:none;" EnablePaging="true" ZeroRowsText='<%# CMS.GlobalHelper.ResHelper.GetString("ZeroRowsText") %>' WhereCondition="Image is not null" />
我已经检查过,我的网站暂存没有被缓存,所有文件都是正确的。
答案 0 :(得分:2)
根据Product文档类型的Image字段的约束,列是否可能包含空值而不是null?如果字段为空或空,请尝试添加其他where条件检查。
<cms:CMSRepeater ID="rptProducts" runat="server"
Path="/Products/%"
ClassNames="Products.Item"
TransformationName="Product.ProductList"
SelectOnlyPublished="true"
StopProcessing="true"
PagerControl-PageSize ="4"
PagerControl-PageNumbersSeparator=""
PagerControl-BackNextStyle="display:none;"
EnablePaging="true"
ZeroRowsText='<%# CMS.GlobalHelper.ResHelper.GetString("ZeroRowsText") %>'
WhereCondition="Image IS NOT NULL AND Image <> ''"
/>