1

I am having a requirement where I need to filter List View Web Part data. For this I am using connected filter web part (text). The column I need to filter is also of type text, but I need to check for contains. I need to satisfy following two conditions:

  1. When filter is blank, it must show all the the items.
  2. When filter is having text it must show all the items that contains filter key.

Using SPD I had modified the List View Web Part query to following:

<Query>
    <Where>
        <Contains>
            <FieldRef Name="ABC"/>
            <Value Type="Text">{ABC}</Value>
        </Contains>
    </Where>
</Query>

Here variable ABC comes from ParameterBinding which is basically pointing to Filter Web Part.
The query is working fine and returning the result when the filter contains keyword. But when the filter is empty, it is not showing any of the item in view. I know this issue arise because of Contains in CAML Query. But do we have any solution for such problem? Like conditional CAML Query?

  • Also initially i want to display all the records. Later user can add filter. – ThinkB4Code Jun 14 '17 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.