Developer forum

Forum » Templates » Itempublisher filter by querystring using @Request("RegionsNew")

Itempublisher filter by querystring using @Request("RegionsNew")

Sten Hougaard
Reply

Hi,

I do not get my items filtered when I try to filter using querysting like 

@Request("RegionsNew")

I have added a filter where a condition have been added "Regions New" er lig med @Request("RegionsNew")

The result is that the page never shows anything. What am I doing wrong?


Med venlig hilsen/Best regards,

Sten Hougaard
Webudvikler

E: sho@1stweb.dk
M: 29850818
A: København/Aarhus . W: www.1stweb.dk
@: netsi1964


Replies

 
Mikkel Ricky
Reply

Try removing the quotes around "RegionsNew", i.e. write @Request(RegionsNew).

If that doesn't work: What are the values of "Regions New" (on the items/in the database)? How does your query string look? Do you have an example we can take a look at?

Best regards,
Mikkel

 
Sten Hougaard
Reply

Hi Mikkel,

Example querystring (the search part):

?regionsnew=Europe

The item definition looks like this:

<field name="Regions new" systemName="RegionsNew" description="" type="System.Collections.Generic.IEnumerable`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib">
        <editor type="Dynamicweb.Content.Items.Editors.CheckboxListEditor`1, Dynamicweb">
          <editorConfuguration><Parameters addin="Dynamicweb.Content.Items.Editors.CheckboxListEditor`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"><Parameter addin="Dynamicweb.Content.Items.Editors.CheckboxListEditor`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]" name="LabelPosition" value="0" /><Parameter addin="Dynamicweb.Content.Items.Editors.CheckboxListEditor`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]" name="IconPosition" value="0" /><Parameter addin="Dynamicweb.Content.Items.Editors.CheckboxListEditor`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]" name="IconMaxWidth" value="0" /><Parameter addin="Dynamicweb.Content.Items.Editors.CheckboxListEditor`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]" name="IconMaxHeight" value="0" /></Parameters></editorConfuguration>
        </editor>
        <validators>
          <validator type="Dynamicweb.Content.Items.Editors.RequiredValidator, Dynamicweb" errorMessage="" />
        </validators>
        <options sourceType="Static">
          <Static>
            <option name="North America" value="NorthAmerica" icon="" />
            <option name="South America" value="SouthAmerica" icon="" />
            <option name="Europe" value="Europe" icon="" />
            <option name="Africa" value="Africa" icon="" />
            <option name="Asia" value="Asia" icon="" />
          </Static>
        </options>
      </field>

So it is a checkbox.

/Sten

 
Mikkel Ricky
Reply

Did removing the quotes around "RegionsNew", i.e. write @Request(RegionsNew), solve the issue?

 

 
Sten Hougaard
Reply

No, I am afraid not..

 
Mikkel Ricky
Reply

I know it's not very useful to you, but it works fine for me. Does your item publisher show anything if you remove the filter? Do you have a public solution we can take a look at?

 
Sten Hougaard
Reply

If I remove the filter it shows as expected items. I am afraid you can not gain access to at public solution.

 
Mikkel Ricky
Reply
This post has been marked as an answer

The item publisher only shows items with RegionNew matching the value specified in the query string, i.e. if you do not specify the RegionsNew parameter, then no items will be shown (as they don't match).

On the page http://mri.net.dynamicweb-cms.com/Default.aspx?ID=416&RegionsNew=Asia, I've created two item publishers; one with filter "RegionsNew is @Request(RegionsNew)" and one with filter "RegionsNew is not @Request(RegionsNew)" to show how it works.

Best regards,
Mikkel

Votes for this answer: 1

 

You must be logged in to post in the forum