S
Søren Reinke
Hi there.
I am trying to get to know LINQ in combination with a bindingsource and
a datagridview.
In the framework we have at work we have created a usercontrol to do
filtering via textboxes on a datagridview. Therefore we databind through
a bindingsource.
But when i load the data from the database via LINQ instead of through a
datatable, i can't seem to get the filter property to work on the
bindingsouce. I can set it but absolutly nothing happens.
Do i have to do something special to get it to work with LINQ, or is it
simple not possible ?
If you need some source, i'll gladly make an example and post it.
In words, what i do is.
The datagridview has the bindingsource as datasource,
I load data from the database via LINQ.
Then i set the columns on the datagridview to be those contained in the
data from the database (primary key, a name).
I set the database to the 'var' which contains the LINQ's request result.
If i run the program i get the data shown, and i can sort when clicking
on the columnheaders and all that.
But if i set the filter with something like:
bindingsource.Filter="Key>25";
Absolut nothing happens, it still shows rows in the datagrid where the
primary key 'Key' is lower or equal to 25.
What is important is that the '25' in the above example can be a number
coming from a user input in the program.
Hope you can help.
Best regards
Søren Reinke
www.Dykkeren.dk
I am trying to get to know LINQ in combination with a bindingsource and
a datagridview.
In the framework we have at work we have created a usercontrol to do
filtering via textboxes on a datagridview. Therefore we databind through
a bindingsource.
But when i load the data from the database via LINQ instead of through a
datatable, i can't seem to get the filter property to work on the
bindingsouce. I can set it but absolutly nothing happens.
Do i have to do something special to get it to work with LINQ, or is it
simple not possible ?
If you need some source, i'll gladly make an example and post it.
In words, what i do is.
The datagridview has the bindingsource as datasource,
I load data from the database via LINQ.
Then i set the columns on the datagridview to be those contained in the
data from the database (primary key, a name).
I set the database to the 'var' which contains the LINQ's request result.
If i run the program i get the data shown, and i can sort when clicking
on the columnheaders and all that.
But if i set the filter with something like:
bindingsource.Filter="Key>25";
Absolut nothing happens, it still shows rows in the datagrid where the
primary key 'Key' is lower or equal to 25.
What is important is that the '25' in the above example can be a number
coming from a user input in the program.
Hope you can help.
Best regards
Søren Reinke
www.Dykkeren.dk