Greetings
I am trying to create a basic filtering functionality similar to the found at the Demo documentation at http://demos.telerik.com/aspnet-ajax/listview/examples/filtering/defaultcs.aspx
The only distinction is that my application uses ObjectDataSource to bind the RadListView control. Here is a brief about the ObjectDataSource
The ListView Binds with No Problem. It is doing what it Suppose to do..
However, when in try to implement a filter similar to the demo one, the filter is not functional and it throws me an error. Here is how i go about Implementing the filter..
The filer is throwing me the following exception::
System.InvalidOperationException: DataReader has been closed @ RadListViewFriendSelection.Rebind()
Could you help me implement a simple filter into this application? To filter - The "Name" field of the ListView control using "Contains". notice that I am accessing an SQLite data. I don't know if this happen to influence. In which case, I will be open to suggestions of implementing filtering in a different way.
Thank you for your help.
I am trying to create a basic filtering functionality similar to the found at the Demo documentation at http://demos.telerik.com/aspnet-ajax/listview/examples/filtering/defaultcs.aspx
The only distinction is that my application uses ObjectDataSource to bind the RadListView control. Here is a brief about the ObjectDataSource
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" TypeName="FriendBarDataSet" SelectMethod="GetFriends" OnSelecting="ObjectDataSource1_Selecting"> <SelectParameters> <asp:Parameter Name="UserTable" /> </SelectParameters></asp:ObjectDataSource> protected void ObjectDataSource1_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) { e.InputParameters["UserTable"] = UserTable; }/// And in the FriendBarDataSet Classpublic SQLiteDataReader GetFriends(string UserTable) { SQLiteConnection connection = new SQLiteConnection(WebConfigurationManager.ConnectionStrings["ConnectionString2"].ConnectionString); SQLiteCommand cmd = new SQLiteCommand(); cmd.Connection = connection; StringBuilder SelectCommand = new StringBuilder(); string Table = "[" + UserTable.ToString() + "]"; string SQL = "SELECT [ID], [uid], [Name], [sex], [birthday_date] FROM "; string completeCommand = SQL + Table; SelectCommand.Append(completeCommand.ToString()); cmd.CommandText = SelectCommand.ToString(); connection.Open(); return cmd.ExecuteReader(CommandBehavior.CloseConnection); }The ListView Binds with No Problem. It is doing what it Suppose to do..
However, when in try to implement a filter similar to the demo one, the filter is not functional and it throws me an error. Here is how i go about Implementing the filter..
if (!String.IsNullOrEmpty(TextBoxFilter.Text)) { RadListViewFriendSelection.FilterExpressions.Clear(); RadListViewFriendSelection.FilterExpressions.BuildExpression().Contains("Name", TextBoxFilter.Text.Trim()).Build(); RadListViewFriendSelection.Rebind(); }The filer is throwing me the following exception::
System.InvalidOperationException: DataReader has been closed @ RadListViewFriendSelection.Rebind()
Could you help me implement a simple filter into this application? To filter - The "Name" field of the ListView control using "Contains". notice that I am accessing an SQLite data. I don't know if this happen to influence. In which case, I will be open to suggestions of implementing filtering in a different way.
Thank you for your help.