0

I'm working on a filter web part inherited from another developer and it's the first time I've worked on them. It currently allows for a single filter and another filter needs to be added. Initial thoughts are something like:

// Existing filter property
[ConnectionConsumer("ProgramEntityLevel", "ProgramEntityLevel", AllowsMultipleConnections = true)]
// New filter property
[ConnectionConsumer("ProgramEntityGuid", "ProgramEntityGuid", AllowsMultipleConnections = true)]
public void SetFilter(IFilterValues filterValues)
{
    // ...
}

However of course it's not possible to have multiple ConnectionConsumer attributes.

Any ideas?

2

I presume you are using the ITransformFilterValues (or similar) interface? You may want to consider implementing the obsoleted filter interfaces instead, since by going via IFilterProvider you can simply send a FilterString such as Filter1=Value1&Filter2=Value2 to your connected consumer Web Parts.

When we developed FilterZen, we implemented the interface you used (for sending "multiple values") as well as the obsoleted interfaces (for sending "multiple filters"). This allowed for greatest compatibility with out-of-box and third-party consumer Web Parts.

1
  • Yes, using ITransformFilterValues. Combining the values seems to be the only way. Thanks for sharing how you developed your product! – Alex Angas Dec 21 '09 at 0:18
1

Its not entirely clear what you want to achieve, so maybe if you could clearify the specs for the task?

I dont think you can have two filters in one filter web part.

Arguably a better design would be to split it up in two filter web parts, but according to this thread, the design for AllowMultipleConnections is that a provider can have more than one consumer, but not the other way around. At the end of the thread this however there seems to be some confusion to if that is the case or not, so you could test it.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.