Can I use filter in repeater if Yes than How? it is possible in asp.net c# ?
In my project I put the filter for dynamic data in repeater.
see the example i want that type of filter in Repeater Click here
Can I use filter in repeater if Yes than How? it is possible in asp.net c# ?
In my project I put the filter for dynamic data in repeater.
see the example i want that type of filter in Repeater Click here
Since your repeater is bound to a DataSource, you should apply the filter condition to it. For example, if the Datasource is represented by the SQLDataSource, please refer to the SqlDataSource.FilterExpression Property topic. This appears to be a client side filtering. If so the best solution would be to set the SQLDataSource.SelectCommand property so that it fetches required data from the DB. This will reduce the data size transferred from the DB Server to the WebServer and make your application work faster.
What do you mean by "filter" ? I think you have to do it on your datasource.
If you want to filter in the browser, then you need to use JavaScript to show and hide the main element for each Item.
If you are filtering on the server, you need to do the filtering on the DataSource to remove the entries you don't want and DataBind() the Repeater each time this changes. You can do the filtering manually using code, or use the FilterExpression if it is available as suggested by platon.
The correct way is to filter your data on the data source, how ever in repeater you can also filter them and show them or not as:
<asp:Repeater ID="rMyID" runat="server">
<ItemTemplate>
<% if (Condition) { %>
Show this line
<%} %>
</ItemTemplate>
</asp:Repeater>
I think best way is using datatable filter property. Here is a simple example.
_dt = _dt.Select("COLUMN_NAME <> 'YOURFILTER'").CopyToDataTable();