Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi i have a grid view that it include two boolean and string field and i wannna search in this grid via a checkbox and a textbox separately .
i use sqlDataSource but becuse of when i use of one sqlDataSource for a grid perch "AND" between to condition (because of i use wizard of course also "or" operator cant supply better result )and result become wrong;
it is my code
ASP.NET
<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:mConnectionString %>" 
        
        SelectCommand="SELECT * FROM [category] WHERE (([subject] = @subject) AND ([status] = @status))">
        <SelectParameters>
            <asp:ControlParameter ControlID="title" Name="subject" PropertyName="Text" 
                Type="String" />
            <asp:ControlParameter ControlID="RadioButton1" Name="status" 
                PropertyName="Checked" Type="Boolean" />
        </SelectParameters>
    </asp:SqlDataSource>

i want gridview show the recordes that it has boolean field when chek box tick and when textbox fill and i press the button grid show the recordes that are equal with text box content.
iam not persistent to use sqldatasource if exist better solution i accept it
please help me its force
thanks a lot for reply
Posted
Updated 5-Mar-12 16:47pm
v5
Comments
behrad110 6-Mar-12 4:14am    
is any reply
Oshtri Deka 9-Mar-12 3:23am    
Do you want search or filtering? From what I've read you want to filter data, don't you?

1 solution

You can pass the SqlCommand from code behind on form load.

And in the checkbox checked event requery the SqlCommand which has the boolean field

And in textbox keypress event requery the SqlCommand for the word in the textbox.

And display the grid.

Hope it is clear to you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900