The below works correctly and filters my gridview based on the text entered in my textbox.
When no text is entered into my textbox I get no results and cannot understand why.
MY QUESTION
How to get a gridview to show all table rows when no text is entered in the textbox?
MSSQL
@Search nvarchar(50)
SELECT [table].[column]
FROM [table]
WHERE [table].[column] LIKE '%' + @Search + '%' OR COALESCE(@Search,'') = ''
MARKUP
<asp:TextBox ID="txtSearch" RunAt="Server" Text=""/>
<asp:SqlDataSource ID="sqlSearch" RunAt="Server" SelectCommand="spSearch" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter Type="String" Name="Search" ControlID="txtSearch" PropertyName="Text"/>
</SelectParameters>
</asp:SqlDataSource>
RESULTS TO GRIDVIEW
I have tried and tested many methods found on here however all return 0 results when string is empty.