Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Passing variables using the address bar View modes: 
User avatar
Certified Developer 10
Certified Developer 10
varinder-kudosweb - 6/5/2011 3:37:28 AM
   
Passing variables using the address bar
Hello,
is it possible to use custom urls for menu items, something like

<website>.com/home.aspx?<variableName>=value&<variableName>=value... etc?

cheers :)

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 6/5/2011 3:50:56 AM
   
RE:Passing variables using the address bar
Hi,

You could use wildcards to achieve your goal. The URL:

http://domain.com/page/test.aspx

will be resolved to

http://domain.com/page.aspx?param=test

The query parameter you can use in web parts using {%param%} which is a query macro.

Best regards,
Ivana Tomanickova

User avatar
Certified Developer 10
Certified Developer 10
varinder-kudosweb - 6/5/2011 6:31:12 AM
   
RE:Passing variables using the address bar
Sory for being a pain again but im still trying to get my head around this.
lets say i have a home menu item which takes me to a page called 'home.aspx' now instead of going to home.aspx i want it to take some variables as wel something like 'home.aspx?param=test&param1=test'
how would you achieve this on a menu item? -hope it makes sense. :)

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 6/5/2011 6:47:54 AM
   
RE:Passing variables using the address bar
Hi,

What about using Properties of document - Menu tab and set URL redirection. Here you could define URL with parameters.

Is this solution suitable for you?

Best regards,
Ivana Tomanickova

User avatar
Certified Developer 10
Certified Developer 10
varinder-kudosweb - 6/5/2011 6:53:11 AM
   
RE:Passing variables using the address bar
I tried to re-direct from 'home.aspx' to 'home.aspx?param1=test' but clearly my browser came up with an error saying 'the page is re-directing itself in a way it will never be completed'

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 6/5/2011 7:32:24 AM
   
RE:Passing variables using the address bar
Hi,

Yes, you are right. The redirection will work only in case you would like to pass parameters to some other page.

Could you please descriebe why you need to pass query parameters to the page itself? Maybe there is an easier solution to achieve your goal.

If this functionality is necessary for your project, you could slightly modify the menu web part you are using. Navigation web parts have RenderedHtml property which you can modify before the page is rendered (so you could add appropriate query parametres).

More information about modifying RenderedHtml property you can find in this thread.

Best regards,
Ivana Tomanickova

User avatar
Certified Developer 10
Certified Developer 10
varinder-kudosweb - 6/5/2011 11:33:44 AM
   
RE:Passing variables using the address bar
Because every page has a repeater which shows data based on a where condition that matches some values with the query string passed in the url.

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 6/6/2011 1:16:38 AM
   
RE:Passing variables using the address bar
Hi,

in this case you could write a custom macro which will be resolved according to the current alias path (CMSContext.CurrentAliasPath;) of selected node and create where part dynamically. If your where part contains apostrophe ('), please read this thread to resolve query correctly. If your returned value does not contain ' reading of above thread is not needed.

Best regards,
Ivana Tomanickova