Good afternoon - using the Entity Framework / an Entity Data Source, I need to get the data the user has filtered from the Grid. What's the easiest way?
It seems difficult to iterate through the entire paged data-set getting ID's and then re-fetching all the rows based on the Primary Key/ID.
I've found a "double rebind" hack works quite well - though not sure on performance yet - but I'd be interested to hear the best options:
It seems difficult to iterate through the entire paged data-set getting ID's and then re-fetching all the rows based on the Primary Key/ID.
I've found a "double rebind" hack works quite well - though not sure on performance yet - but I'd be interested to hear the best options:
private bool StoreInLocalVariable;
private Collection<CustomerData> CustomerData;
protected
void
btnGetData_Click(
object
sender, EventArgs e)
{
// Rebind grid without paging to get full data-set
StoreInLocalVariable = true;
rgCustomerBalance.AllowPaging =
false
;
rgCustomerBalance.Rebind();
var result = CustomerData;
// Restore grid back to normal (i.e. with paging)
StoreInLocalVariable =
false
;
rgCustomerBalance.AllowPaging =
true
;
rgCustomerBalance.Rebind();
// Do something with Result
}
// Entity Data Source Selected
protected
void
edsCustomerData_Selected(
object
sender, EntityDataSourceSelectedEventArgs e)
{
if
(StoreInLocalVariable)
{
CustomerData =
new
Collection<CustomerData>(e.Results.Cast<CustomerData>().ToList());
}
}