trint99
-
8/22/2006 12:16:18 AM
Setting attributes of the CMSDataList
I am using a CMS datalist to display cms.product objects. I have the following tree structure...
/ - Account - Product (Folder) - - Products (MenuItem that uses my products page template) - - Product A - - Product B - - Product C - Store
I have manipulated the folder object to allow products and menu items as children so that I can have a better organization within my tree. I have also done some customization of the product object.
The issue I have is this. If I set the attributes of the CMSDataList in the ASPX markup of my template, the attributes do not have any affect on the control.
<cms:CMSDataList ID="CMSProductList" runat="server" SelectNodesPath="/Product/%" SelectNodesPathType="AliasPath" SelectNodesClassName="CMS.Product" TransformationName="cms.product.default" />
When I Response.Write the SelectNodesPath of this control in the Page_Load method, it always comes back as the path of the current page. If I navigate to the Products page, the SelectNodesPath is set to Product/Products/% which finds no products and the control is empty. If I navigate to the template itself, the SelectNodesPath is /% which finds all products, not just those in the /Product/% path.
If I set the attributes within the code behind they do seem to take affect.
CMSProductList.SelectNodesPath = "/Product/%"; CMSProductList.SelectNodesPathType = TreePathTypeEnum.AliasPath;
With this, the products are rendered correctly.
Why do the attributes not work in the ASPX page? I would rather have it there in uncompiled code than in the compiled .cs code behind page.
|