here's the logic i want to perform.
When the textbox is empty, i want the datagrid showing no record.
When the textbox is not empty, then the datagrid will filter the data.
Right now, when the textbox is empty, it shows all the records.
How can i fix that? Thanks in advance!
here's the code block:
<asp:SqlDataSource ID="dsGridview" runat="server" ConnectionString="<%$ ConnectionStrings:MyConnectionString %>"
SelectCommand="SELECT UserName, gender, age FROM users"
FilterExpression="UserName like '%{0}%'">
<FilterParameters>
<asp:ControlParameter Name="UserName" ControlID="txtSearch" PropertyName="Text" />
</FilterParameters>
</asp:SqlDataSource>