views:

27

answers:

0

Hello Everyone!,

I want to refresh GridView based upon whether a particular <asp:CheckBox> has been selected or not.

I am using <asp:SqlDataSource with a SelectCommand and my query goes like this..

SelectCommand="SELECT * from [Table1] where [COL1] in (case when @checkbox=1 then 'FOO' else 'BAR')...

and the <SelectParameters> have been properly defined to use the proper checkbox's ID and propertyName.

But it's not working if in any of the following queries

1.a) SelectCommand="SELECT * from [Table1] where [COL1] in (CASE when @checkbox=1 then 'FOO' else '%' END)... --I want to retrieve ALL

1.b) then 'FOO' else '[a-z]%' END

2.a) SelectCommand="SELECT * from [Table1] where [COL1] in (case when @checkbox=1 then 'FOO' else '''FOO'',''BAR''' END)... --Retrieve either FOO or BAR

Can someone help me where I am going wrong with these queries?? I prefer to keep the query within <asp:SelectParameters> as far as possible..

Thanks!!