cshanks-tmw
-
4/21/2010 4:59:09 AM
cms:QueryRepeater WhereCondition - Please help!
ASPX Page: <cms:QueryRepeater runat="server" ID="videoDisplay"></cms:QueryRepeater>
ASPX .CS Page:
protected void Page_Init(object sender, EventArgs e) { Knorr.Kentico.Domain.CMSDocument doc = new Knorr.Kentico.Domain.CMSDocument(CMS.CMSHelper.CMSContext.CurrentDocument.DocumentID); videoDisplay.WhereCondition = doc.DocumentForeignKeyValue.ToString(); videoDisplay.QueryName = "custom.recipe.videoDisplay"; videoDisplay.TransformationName = "custom.recipe.videoDisplay"; } CMSSiteManager > Development > Document types > Recipes (custom.recipe)
> Queries > videoDisplay
select a.RecipeID RecipeID, tbl2.RecipeID RecipeID2, a.RecipeVideo RecipeVideoGUID, b.NodeGUID RecipeVideoNodeGUID, b.NodeAliasPath RecipeVideoAliasPath, tbl2.RecipeMainImage MainImageGUID, tbl2.NodeGUID MainImageNodeGUID, tbl2.NodeAliasPath MainImageNodeAliasPath from dbo.custom_recipe a with(nolock) inner join dbo.CMS_Tree b with(nolock) on (a.RecipeVideo = b.NodeGUID) inner join (select y.RecipeID, y.RecipeMainImage, x.NodeGUID, x.NodeAliasPath from dbo.custom_recipe as y with(nolock) inner join dbo.CMS_Tree as x with(nolock) on (y.RecipeMainImage = x.NodeGUID) where (y.RecipeMainImage != '')) tbl2 on a.RecipeID = tbl2.RecipeID where (a.RecipeVideo != '' and a.RecipeID = ##WHERE##)
(this query works perfectly if I hard code a value in place of the ##WHERE## ie: '5', '32' etc)
Transformations > videoDisplay
<script type="text/javascript"> var flashvars = {videoPath:'http://localhost:1469/Web<%# Eval("RecipeVideoAliasPath") %>.flv', imagePath:'http://localhost:1469/Web<%# Eval("MainImageNodeAliasPath") %>.jpg', videoWidth:570, videoHeight:320, printUrl:'http://www.bbc.co.uk', moreUrl:"http://www.bbc.co.uk"}; var params = {bgcolor:"#FFFFFF", allowfullscreen:"true"}; var attributes = {id:"flash", name:"flashVideo"}; swfobject.embedSWF('http://localhost:1469/Web/CMSTemplates/knorr/flash/application.swf', "flashVideo", "570", "320", "10.0.0", "", flashvars, params, attributes); </script>
This ENTIRE thing works correclty if I hard-code the WhereCondition in the cms:QueryRepeater ie: <cms:QueryRepeater runat="server" ID="videoDisplay" TransformationName="custom.recipe.videoDisplay" QueryName="custom.recipe.videoDisplay" WhereCondition="5"></cms:QueryRepeater>
But I need dynamically add the WhereCondition - as it needs to be different per page.
Can anyone please help me make this work - am I doing something wrong?
|