score:3
you should use
gridcontrol.datasource = staticclass.getfilteredlist(10).tolist();
to create a new list
instance to bind to your grid.
another way is to use a bindinglist
, which fully supports databinding and gives you usefull events like listchanged
and addingnew
.
var list = new bindinglist(staticclass.getfilteredlist(10).tolist());
gridcontrol.datasource = list;
score:0
public static ienumerable<myobject> getfilteredlist(int doctype)
{
var fitems = from i in list
where i.doctype.doctypeid == doctype
select i;
return fitems;
}
correct me if i am wrong but right now it seems as if you are comparing an int with the doctype class. if that's not the case then your query could just be returning an empty set since it can't find anything that matches.
score:2
try
gridcontrol.datasource = staticclass.getfilteredlist(10).tolist();
because datasource must be inherited from ilist
score:2
you ca try with tolist()
gridcontrol.datasource = staticclass.getfilteredlist(10).tolist();
gridcontrol.databind();
Source: stackoverflow.com
Related Query
- Using LINQ query result for data source for GridControl c#
- how to fetch data from database using linq query for relationship 1:N and N:N (between 3 entity) in asp.net mvc EF code first?
- Using ToList() on Enumerable LINQ query results for large data sets - Efficiency Issue?
- LINQ query help: searching for data in a Many to Many using Entity Framework
- Can I use a LINQ IEnumerable result as the data source for a Gtk.TreeView?
- How to check linq query result against Sql Server Database for data already exist or not?
- Using the result of one LINQ query as the parameter for the next
- LINQ Intersect Query for Many to Many relationship using .NET4 MVC4 Code First
- LINQ query code for complex merging of data
- Getting result of Linq query after data binding a control without explicitly using .ToList() in ASP.Net
- Steps for a beginner to run very basic linq to sql query using Linqpad
- Query data using "Contains" keyword in Dynamic Linq in C#
- Dynamic linq query expression tree for sql IN clause using Entity framework
- LINQ to SQL: Complicated query with aggregate data for a report from multiple tables for an ordering system
- Is there any way to create a LINQ query as a variable without having the data source (yet)?
- LINQ - using a query expression to calculate data time difference
- How to reuse a linq expression for 'Where' when using multiple source tables
- What is the return type for a anonymous linq query select? What is the best way to send this data back?
- linq - how do you do a query for items in one query source that are not in another one?
- How can I write the following code more elegantly using LINQ query syntax?
- Using LINQ for CSV data
- Advanced LINQ Grouping and Projection Query for Hierarchical Data (EF 4.0 + LINQ + ASP.NET MVC + HighCharts)
- C# Using LINQ Query compare the records with result of process array
- LinQ Query for selecting multiple data in single row
- Use a linq query as microsoft local report Data Source (WinForms)
- Determine the source DataContext for a Linq to Sql query
- Retrieve bool result by using LinQ code
- EXTREMELY Poor LINQ Query Performance When Using Skip/Take for Paging
- IN query using LINQ for IEnumerable List of items
- Pull data from multiple tables in one SQL query using LINQ and Entity Framework (Core)
More Query from same tag
- Join Item from X,Y Coordinates in Linq
- Equivalent sql code insert/sql in entity framework in code-first
- Error during a simple typecast
- Distinct all columns in a datatable and store to another datatable with LINQ
- IList.Select() that returns an IList (without copying)
- jQuery Datatable with MVC 5 and Entity Framework
- SQL return consecutive records
- Stored Procedure does not and should not return anything results in error
- Method result in groupby
- what is inner equijoin?
- How do i expand on this expression?
- Entity Framework LINQ Query using Custom C# Class Method - Once yes, once no - because executing on the client or in SQL?
- C# and Linq launching combined Linq query
- C# Linq - group where multiple columns match?
- Perform group and join using LINQ
- How to create a dummy database for functional tests in .NET Core?
- Assistance with Linq Query
- Entity Framework ICollection to List
- LinQ & DataTable Group By Question in C#
- Conditional filter using LINQ with C#
- undefined number of Or-operation on List
- How to compare list of strings to a string where elements in the list might have letters be scrambled up?
- left non equi join linq
- Goto in the ElementAt extension method
- LINQ query to ado.data entity model selecting more than one column in c#
- LINQ To Datatable using "Any" with a List
- Populate List<string> from DataTable column
- JSON to a custom object hierarchy
- How can do an invariant .Contains(myQuery) with Linq to Objects?
- Apply multiple expression in linq