Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Macro's View modes: 
User avatar
Member
Member
anthony.halliday - 1/31/2013 6:47:20 AM
   
Macro's
Hi, I have a page setup with a repeater and a filter bar, basically the filter redirects the user to the same page with a parameter "Sort" added e.g. ~/Home?Sort=SomeSortCriteria

At the minute the repeaters "Order by" field just has {%Sort%} which works fine but when there is no parameter the items are not ordered so i would like to order the items a-z by default unless there is a sort parameter in the url.

I have been trying a number of macros along the lines of:
{(1)%{%Sort%}|(equals){(2)%EmptyString%(2)}|(truevalue){%Sort%}|(falsevalue)"DocumentName ASC"#%(1)}

desired outputs:
URL: Home.aspx | Order By: "DocumentName ASC"
URL: Home.aspx?Sort=SortCritria | Order By: "SortCriteria"

Any comments on where i am going wrong would be greatly appreciated.

Thanks, Anthony.

User avatar
Member
Member
anthony.halliday - 1/31/2013 8:15:59 AM
   
RE:Macro's
Solved.

If anyone happens to be interested, i used:
{%
if (QueryString.GetValue("Sort")==null)
{return "DocumentName ASC";}
else {return QueryString.GetValue("Sort");}
%}

User avatar
Kentico Support
Kentico Support
kentico_janh - 1/31/2013 10:34:09 AM
   
RE:Macro's
Hello,

Yes, you don't have to use that old one-line macro format and you can take advantage of the complex K# macros. For more information about K# please follow the link below to our documentation:

K# syntax

Best regards,
Jan Hermann