Hello,
I'm trying to set up a RadGridView to display a RadEntityFrameworkCoreDataSource source using code-behind (currently a requirement) and cannot get the grid to populate with any data. I can access the data by using LINQ just fine, and can populate the grid using a ToList() version of that data, but I believe that it's just a copy of the data, and cannot be modified and saved to the original context.
Here's an example of what I'm trying to do:
var options = new DbContextOptionsBuilder<Test_Context>();
options.UseSqlServer(ConnectionString);
using var testContext= new Test_Context(options.Options);
RadEntityFrameworkCoreDataSource source = new()
{
Name = "coreDataSource",
DbContext = testContext,
QueryName = "TblCustomer"
};
// This doesn't populate the grid
rgvCustomers.ItemsSource = source.DataView;
// This populates the grid
var customerList = textContext.TblCustomer.Where(customer => customer.Id != -1).ToList();
rgvCustomers.ItemsSource = customerList ;
How do I get the RadEntityFrameworkCoreDataSource to query the data so that it can populate the grid?
Also, how would I go about only querying the customers with an Id != -1 using said Data Source? Is that as simple as setting the filters, then querying?
I'm new to this, so apologies if I've missed a simple step.