Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > QueryString Macro not working View modes: 
User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 1/16/2013 11:47:19 AM
   
QueryString Macro not working
I've created a webpart that takes an integer parameter. The parameter is gathered by query string and never returns the value of the query string.

I have my page URL path property setup with a wildcard like so:

/PageName/Details/{ItemNumber}

And it displays the page as well as the specific data when I view the details for other webparts.

In my webpart property within CMSDesk I simply put {% ItemNumber %} in as the value and it always returns 0. Is there a specific time in the lifecycle of a webpart I should/shouldn't be grabbing this query string value? I've attempted in both the OnContentLoaded() and OnPreRender() events with no success.

User avatar
Kentico Support
Kentico Support
kentico_janh - 1/16/2013 12:33:33 PM
   
RE:QueryString Macro not working
Hello,

Please remove those spaces in your query string macro to make it work:

{%ItemNumber%}


Best regards,
Jan Hermann

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 1/16/2013 5:31:06 PM
   
RE:QueryString Macro not working
Didn't know that was a requirement, your suggestion worked! Are there other requirements for macros like this? I guess I didn't see anything like that explained in the documentation.

User avatar
Kentico Support
Kentico Support
kentico_janh - 1/17/2013 4:14:09 AM
   
RE:QueryString Macro not working
Hello,

Actually, all old format one-line macros are space sensitive, however you can get the query string through the K# as well and there you can format your macro with any number of spaces you want:

{% QueryString.GetValue("ItemNumber") %}


Best regards,
Jan Hermann