help me to find the values

ramesh perera asked on November 2, 2015 08:17

Hi Friends!

how can i get the param1, param2, param3 and param 4 values from following query string in the repeater where condition which use in portal site

http://localhost:122/test/page1/?param1=/testSection1/subsection1/item&param2=table&param3=2015-11-05&param4=2015-10-29

Thanks Ramesh

Recent Answers


David te Kloese answered on November 2, 2015 09:23 (last edited on December 10, 2019 02:30)

Hi,

you can read querystring params using the following macro:

{% PARAMETER %}

see Query string macros: https://docs.kentico.com/display/K82/Macro+syntax

To load the values of query string parameters from the URL, use macros in format: {% parameter %}

Query string macros support all K# syntax. The names of all available query string parameters automatically work as variables that store the value of the corresponding parameter.

For example, on pages with URLs like /Home.aspx?nodeid=10, {% nodeid %} resolves into 10.

Alternatively, you can get the values of query string parameters inside standard macros: {% QueryString.parameter |(identity)GlobalAdministrator%}

Greets,

David

1 votesVote for this answer Mark as a Correct answer

ramesh perera answered on November 2, 2015 09:51

Hi David!

Thanks for your kind help. it works fine. thanks. but how can we check whether query string parameters not null. because i want to set the where close when query string parameters are there. other wise need to display all records

Thanks Ramesh

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on November 2, 2015 14:24 (last edited on December 10, 2019 02:30)

Hi,

You can use a basic IF statement. Something like:

{% if(QueryString.param1 != null) { return "param1=" + QueryString.param1 }|(identity)GlobalAdministrator%}

you can also add an else statement if you like..

Greets,

David

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.