Conditional filter expression in asp.net?
<p>So I have two filtering objects. One is a drop down list, which chooses the group of users to look at. Next is the user search box. I would like to use this to filter the results further so that you can search for a user <strong>in the chosen group</strong>.
I have tested the group filter and it works on it's own (without the inclusion of the searchbox).</p>

<p>Now, the problem I face is the default view. What I want to <strong>also</strong> be able to do is choose a group without putting in a user, giving me the complete list of users in that group. Then if I want to filter it down more I would use the searchbox.</p>

<p>Currently I have to use the searchbox in order to have any results show. I suspect it's the default value I have set for the searchbox control parameter, but I am unsure how to fix it (I have tried putting the wildcard in but then it doesn't filter by group anymore)</p>

<p>Here is the filter expression:</p>

<pre><code>FilterExpression="(([Field1] = {0}) AND ([Field2] LIKE '%{1}%'))"
</code></pre>

<p>And here are the parameters:</p>

<pre><code>    &lt;FilterParameters&gt;
    &lt;asp:ControlParameter ControlID="DDL" Name="Field1" 
                          PropertyName="SelectedValue" 
                          Type="Int32" /&gt;
    &lt;asp:ControlParameter ControlID="SearchBox" Name="Field2"  
                          Type="String" /&gt;
    &lt;/FilterParameters&gt;

&lt;SelectParameters&gt;
     &lt;asp:ControlParameter ControlID="DDL" Name="Field1" PropertyName="SelectedValue" Type="Int32" /&gt;  
     &lt;asp:ControlParameter ControlID="SearchBox" Name="Field2" Type="String" DefaultValue="" /&gt;  
&lt;/SelectParameters&gt;
</code></pre>

<p>Any help would be greatly appreciated!</p>
