Entity Framework Select() hide the data [closed]












2















I try to select all unique (expired dates) using Distinct() :



gridView3.Columns[0].FieldName = "pis_ExpireDate";

var EXdates = DB0201.purchases_item_seriels
.Where(u => (u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 0) ||
(u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 5) ||
(u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 6))
.OrderBy(o => o.pis_ExpireDate)
.Select(u => u.pis_ExpireDate).Distinct();

gridControl3.DataSource = EXdates.ToList();


Rows are created but no data appears!



I tried to select all data without Select(u => u.pis_ExpireDate) and it works



I need to show only list of expired dates in Gridview, I use this line to define the first column field name :



gridView3.Columns[0].FieldName = "pis_ExpireDate";
var EXdates = DB0201.purchases_item_seriels
.Where(u => (u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 0) ||
(u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 5) ||
(u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 6))
.OrderBy(o => o.pis_ExpiraeDate);
gridControl3.DataSource = EXdates.ToList();


Rows are created and all data is there.










share|improve this question















closed as unclear what you're asking by Panagiotis Kanavos, TheLethalCoder, marc_s, mega6382, Ron Klein Nov 26 '18 at 20:31


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • 2





    Probably there is grid configuration - field mapping issue.

    – Reniuz
    Nov 26 '18 at 11:08






  • 1





    You didn't post the grid code (data binding, configuration) so one an only guess why the grid doesn't display what you want. It has nothing to do with EF though. The queries you posted return two completely different results. One returns single dates. The other returns complete rows. If you bind a list of dates to a grid that expects line items, you'll get multiple empty rows, simply because there are no values to display for any of the columns

    – Panagiotis Kanavos
    Nov 26 '18 at 11:33













  • rows created and all data appear but without merge what does that mean? There's no attempt to merge anything, in any of the queries. What are you trying to do?

    – Panagiotis Kanavos
    Nov 26 '18 at 11:37











  • i need to show only list of expired dates in Gridview , i use this line to define the first column field name : gridView3.Columns[0].FieldName = "pis_ExpireDate";

    – Bassem Kamal M
    Nov 26 '18 at 11:54






  • 1





    @PanagiotisKanavos already explained it - the problem is that data binding expects a list of objecst having property called "pis_ExpireDate" while in the non working case you are feeding it with list of dates. I guess changing .Select(u => u.pis_ExpireDate) to .Select(u => new { u.pis_ExpireDate }) would be enough.

    – Ivan Stoev
    Nov 26 '18 at 12:03
















2















I try to select all unique (expired dates) using Distinct() :



gridView3.Columns[0].FieldName = "pis_ExpireDate";

var EXdates = DB0201.purchases_item_seriels
.Where(u => (u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 0) ||
(u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 5) ||
(u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 6))
.OrderBy(o => o.pis_ExpireDate)
.Select(u => u.pis_ExpireDate).Distinct();

gridControl3.DataSource = EXdates.ToList();


Rows are created but no data appears!



I tried to select all data without Select(u => u.pis_ExpireDate) and it works



I need to show only list of expired dates in Gridview, I use this line to define the first column field name :



gridView3.Columns[0].FieldName = "pis_ExpireDate";
var EXdates = DB0201.purchases_item_seriels
.Where(u => (u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 0) ||
(u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 5) ||
(u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 6))
.OrderBy(o => o.pis_ExpiraeDate);
gridControl3.DataSource = EXdates.ToList();


Rows are created and all data is there.










share|improve this question















closed as unclear what you're asking by Panagiotis Kanavos, TheLethalCoder, marc_s, mega6382, Ron Klein Nov 26 '18 at 20:31


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • 2





    Probably there is grid configuration - field mapping issue.

    – Reniuz
    Nov 26 '18 at 11:08






  • 1





    You didn't post the grid code (data binding, configuration) so one an only guess why the grid doesn't display what you want. It has nothing to do with EF though. The queries you posted return two completely different results. One returns single dates. The other returns complete rows. If you bind a list of dates to a grid that expects line items, you'll get multiple empty rows, simply because there are no values to display for any of the columns

    – Panagiotis Kanavos
    Nov 26 '18 at 11:33













  • rows created and all data appear but without merge what does that mean? There's no attempt to merge anything, in any of the queries. What are you trying to do?

    – Panagiotis Kanavos
    Nov 26 '18 at 11:37











  • i need to show only list of expired dates in Gridview , i use this line to define the first column field name : gridView3.Columns[0].FieldName = "pis_ExpireDate";

    – Bassem Kamal M
    Nov 26 '18 at 11:54






  • 1





    @PanagiotisKanavos already explained it - the problem is that data binding expects a list of objecst having property called "pis_ExpireDate" while in the non working case you are feeding it with list of dates. I guess changing .Select(u => u.pis_ExpireDate) to .Select(u => new { u.pis_ExpireDate }) would be enough.

    – Ivan Stoev
    Nov 26 '18 at 12:03














2












2








2








I try to select all unique (expired dates) using Distinct() :



gridView3.Columns[0].FieldName = "pis_ExpireDate";

var EXdates = DB0201.purchases_item_seriels
.Where(u => (u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 0) ||
(u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 5) ||
(u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 6))
.OrderBy(o => o.pis_ExpireDate)
.Select(u => u.pis_ExpireDate).Distinct();

gridControl3.DataSource = EXdates.ToList();


Rows are created but no data appears!



I tried to select all data without Select(u => u.pis_ExpireDate) and it works



I need to show only list of expired dates in Gridview, I use this line to define the first column field name :



gridView3.Columns[0].FieldName = "pis_ExpireDate";
var EXdates = DB0201.purchases_item_seriels
.Where(u => (u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 0) ||
(u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 5) ||
(u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 6))
.OrderBy(o => o.pis_ExpiraeDate);
gridControl3.DataSource = EXdates.ToList();


Rows are created and all data is there.










share|improve this question
















I try to select all unique (expired dates) using Distinct() :



gridView3.Columns[0].FieldName = "pis_ExpireDate";

var EXdates = DB0201.purchases_item_seriels
.Where(u => (u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 0) ||
(u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 5) ||
(u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 6))
.OrderBy(o => o.pis_ExpireDate)
.Select(u => u.pis_ExpireDate).Distinct();

gridControl3.DataSource = EXdates.ToList();


Rows are created but no data appears!



I tried to select all data without Select(u => u.pis_ExpireDate) and it works



I need to show only list of expired dates in Gridview, I use this line to define the first column field name :



gridView3.Columns[0].FieldName = "pis_ExpireDate";
var EXdates = DB0201.purchases_item_seriels
.Where(u => (u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 0) ||
(u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 5) ||
(u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 6))
.OrderBy(o => o.pis_ExpiraeDate);
gridControl3.DataSource = EXdates.ToList();


Rows are created and all data is there.







c# entity-framework






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 26 '18 at 12:00









marc_s

576k12911111258




576k12911111258










asked Nov 26 '18 at 10:51









Bassem Kamal MBassem Kamal M

226




226




closed as unclear what you're asking by Panagiotis Kanavos, TheLethalCoder, marc_s, mega6382, Ron Klein Nov 26 '18 at 20:31


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









closed as unclear what you're asking by Panagiotis Kanavos, TheLethalCoder, marc_s, mega6382, Ron Klein Nov 26 '18 at 20:31


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 2





    Probably there is grid configuration - field mapping issue.

    – Reniuz
    Nov 26 '18 at 11:08






  • 1





    You didn't post the grid code (data binding, configuration) so one an only guess why the grid doesn't display what you want. It has nothing to do with EF though. The queries you posted return two completely different results. One returns single dates. The other returns complete rows. If you bind a list of dates to a grid that expects line items, you'll get multiple empty rows, simply because there are no values to display for any of the columns

    – Panagiotis Kanavos
    Nov 26 '18 at 11:33













  • rows created and all data appear but without merge what does that mean? There's no attempt to merge anything, in any of the queries. What are you trying to do?

    – Panagiotis Kanavos
    Nov 26 '18 at 11:37











  • i need to show only list of expired dates in Gridview , i use this line to define the first column field name : gridView3.Columns[0].FieldName = "pis_ExpireDate";

    – Bassem Kamal M
    Nov 26 '18 at 11:54






  • 1





    @PanagiotisKanavos already explained it - the problem is that data binding expects a list of objecst having property called "pis_ExpireDate" while in the non working case you are feeding it with list of dates. I guess changing .Select(u => u.pis_ExpireDate) to .Select(u => new { u.pis_ExpireDate }) would be enough.

    – Ivan Stoev
    Nov 26 '18 at 12:03














  • 2





    Probably there is grid configuration - field mapping issue.

    – Reniuz
    Nov 26 '18 at 11:08






  • 1





    You didn't post the grid code (data binding, configuration) so one an only guess why the grid doesn't display what you want. It has nothing to do with EF though. The queries you posted return two completely different results. One returns single dates. The other returns complete rows. If you bind a list of dates to a grid that expects line items, you'll get multiple empty rows, simply because there are no values to display for any of the columns

    – Panagiotis Kanavos
    Nov 26 '18 at 11:33













  • rows created and all data appear but without merge what does that mean? There's no attempt to merge anything, in any of the queries. What are you trying to do?

    – Panagiotis Kanavos
    Nov 26 '18 at 11:37











  • i need to show only list of expired dates in Gridview , i use this line to define the first column field name : gridView3.Columns[0].FieldName = "pis_ExpireDate";

    – Bassem Kamal M
    Nov 26 '18 at 11:54






  • 1





    @PanagiotisKanavos already explained it - the problem is that data binding expects a list of objecst having property called "pis_ExpireDate" while in the non working case you are feeding it with list of dates. I guess changing .Select(u => u.pis_ExpireDate) to .Select(u => new { u.pis_ExpireDate }) would be enough.

    – Ivan Stoev
    Nov 26 '18 at 12:03








2




2





Probably there is grid configuration - field mapping issue.

– Reniuz
Nov 26 '18 at 11:08





Probably there is grid configuration - field mapping issue.

– Reniuz
Nov 26 '18 at 11:08




1




1





You didn't post the grid code (data binding, configuration) so one an only guess why the grid doesn't display what you want. It has nothing to do with EF though. The queries you posted return two completely different results. One returns single dates. The other returns complete rows. If you bind a list of dates to a grid that expects line items, you'll get multiple empty rows, simply because there are no values to display for any of the columns

– Panagiotis Kanavos
Nov 26 '18 at 11:33







You didn't post the grid code (data binding, configuration) so one an only guess why the grid doesn't display what you want. It has nothing to do with EF though. The queries you posted return two completely different results. One returns single dates. The other returns complete rows. If you bind a list of dates to a grid that expects line items, you'll get multiple empty rows, simply because there are no values to display for any of the columns

– Panagiotis Kanavos
Nov 26 '18 at 11:33















rows created and all data appear but without merge what does that mean? There's no attempt to merge anything, in any of the queries. What are you trying to do?

– Panagiotis Kanavos
Nov 26 '18 at 11:37





rows created and all data appear but without merge what does that mean? There's no attempt to merge anything, in any of the queries. What are you trying to do?

– Panagiotis Kanavos
Nov 26 '18 at 11:37













i need to show only list of expired dates in Gridview , i use this line to define the first column field name : gridView3.Columns[0].FieldName = "pis_ExpireDate";

– Bassem Kamal M
Nov 26 '18 at 11:54





i need to show only list of expired dates in Gridview , i use this line to define the first column field name : gridView3.Columns[0].FieldName = "pis_ExpireDate";

– Bassem Kamal M
Nov 26 '18 at 11:54




1




1





@PanagiotisKanavos already explained it - the problem is that data binding expects a list of objecst having property called "pis_ExpireDate" while in the non working case you are feeding it with list of dates. I guess changing .Select(u => u.pis_ExpireDate) to .Select(u => new { u.pis_ExpireDate }) would be enough.

– Ivan Stoev
Nov 26 '18 at 12:03





@PanagiotisKanavos already explained it - the problem is that data binding expects a list of objecst having property called "pis_ExpireDate" while in the non working case you are feeding it with list of dates. I guess changing .Select(u => u.pis_ExpireDate) to .Select(u => new { u.pis_ExpireDate }) would be enough.

– Ivan Stoev
Nov 26 '18 at 12:03












2 Answers
2






active

oldest

votes


















1














Not sure about grid configuration, but try this solution:



gridView3.Columns[0].FieldName = "pis_ExpireDate";

var EXdates = DB0201.purchases_item_seriels
.Where( u => ( u.stitems_ID == ItemID
&& u.ss_StoreID == StoreID
&& (u.pis_Statues == 0 || u.pis_Statues == 5 || u.pis_Statues == 6 ) ))
.OrderBy( o => o.pis_ExpiraeDate ).Distinct().Select( a => new { pis_ExpireDate = a } )
.ToList();

gridControl3.DataSource = EXdates;


Updated bit query!






share|improve this answer
























  • this error appear System.InvalidCastException: 'Unable to cast object of type 'System.Data.Entity.DynamicProxies.purchases_item_serie_E5008677EB8BFE6A32656BA94B232411B2F01DA5D79EE4F711F972E15AC739D4' to type 'System.IConvertible'.'

    – Bassem Kamal M
    Nov 26 '18 at 16:14











  • thank you , it work after changing to .Select(u => new { u.pis_ExpireDate }) thanks

    – Bassem Kamal M
    Nov 26 '18 at 16:24











  • @BassemKamalM Is it fine if I ask you to mark solution as "Answer"?

    – Ankush Madankar
    Nov 28 '18 at 8:29



















0














Try add this to your query:



.GroupBy(x => x.pis_ExpireDate).Distinct();





share|improve this answer
























  • This won't help at all. It will actuall make things worse. GroupBy returns IGrouping<> objects which are distinct by definition. They'll be unrecognizable by any grid configured to display row items

    – Panagiotis Kanavos
    Nov 26 '18 at 11:31











  • You can also create your own implementation of IEqualityComparer and pass it instance to Distinct() method.

    – Marcin Tyborowski
    Nov 26 '18 at 11:40











  • Which would do what? It would still return an IGrouping<T> instead fo a list of T's , that can't be mapped to any grid.

    – Panagiotis Kanavos
    Nov 26 '18 at 11:42













  • empty grid view appear , no rows created

    – Bassem Kamal M
    Nov 26 '18 at 11:56


















2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Not sure about grid configuration, but try this solution:



gridView3.Columns[0].FieldName = "pis_ExpireDate";

var EXdates = DB0201.purchases_item_seriels
.Where( u => ( u.stitems_ID == ItemID
&& u.ss_StoreID == StoreID
&& (u.pis_Statues == 0 || u.pis_Statues == 5 || u.pis_Statues == 6 ) ))
.OrderBy( o => o.pis_ExpiraeDate ).Distinct().Select( a => new { pis_ExpireDate = a } )
.ToList();

gridControl3.DataSource = EXdates;


Updated bit query!






share|improve this answer
























  • this error appear System.InvalidCastException: 'Unable to cast object of type 'System.Data.Entity.DynamicProxies.purchases_item_serie_E5008677EB8BFE6A32656BA94B232411B2F01DA5D79EE4F711F972E15AC739D4' to type 'System.IConvertible'.'

    – Bassem Kamal M
    Nov 26 '18 at 16:14











  • thank you , it work after changing to .Select(u => new { u.pis_ExpireDate }) thanks

    – Bassem Kamal M
    Nov 26 '18 at 16:24











  • @BassemKamalM Is it fine if I ask you to mark solution as "Answer"?

    – Ankush Madankar
    Nov 28 '18 at 8:29
















1














Not sure about grid configuration, but try this solution:



gridView3.Columns[0].FieldName = "pis_ExpireDate";

var EXdates = DB0201.purchases_item_seriels
.Where( u => ( u.stitems_ID == ItemID
&& u.ss_StoreID == StoreID
&& (u.pis_Statues == 0 || u.pis_Statues == 5 || u.pis_Statues == 6 ) ))
.OrderBy( o => o.pis_ExpiraeDate ).Distinct().Select( a => new { pis_ExpireDate = a } )
.ToList();

gridControl3.DataSource = EXdates;


Updated bit query!






share|improve this answer
























  • this error appear System.InvalidCastException: 'Unable to cast object of type 'System.Data.Entity.DynamicProxies.purchases_item_serie_E5008677EB8BFE6A32656BA94B232411B2F01DA5D79EE4F711F972E15AC739D4' to type 'System.IConvertible'.'

    – Bassem Kamal M
    Nov 26 '18 at 16:14











  • thank you , it work after changing to .Select(u => new { u.pis_ExpireDate }) thanks

    – Bassem Kamal M
    Nov 26 '18 at 16:24











  • @BassemKamalM Is it fine if I ask you to mark solution as "Answer"?

    – Ankush Madankar
    Nov 28 '18 at 8:29














1












1








1







Not sure about grid configuration, but try this solution:



gridView3.Columns[0].FieldName = "pis_ExpireDate";

var EXdates = DB0201.purchases_item_seriels
.Where( u => ( u.stitems_ID == ItemID
&& u.ss_StoreID == StoreID
&& (u.pis_Statues == 0 || u.pis_Statues == 5 || u.pis_Statues == 6 ) ))
.OrderBy( o => o.pis_ExpiraeDate ).Distinct().Select( a => new { pis_ExpireDate = a } )
.ToList();

gridControl3.DataSource = EXdates;


Updated bit query!






share|improve this answer













Not sure about grid configuration, but try this solution:



gridView3.Columns[0].FieldName = "pis_ExpireDate";

var EXdates = DB0201.purchases_item_seriels
.Where( u => ( u.stitems_ID == ItemID
&& u.ss_StoreID == StoreID
&& (u.pis_Statues == 0 || u.pis_Statues == 5 || u.pis_Statues == 6 ) ))
.OrderBy( o => o.pis_ExpiraeDate ).Distinct().Select( a => new { pis_ExpireDate = a } )
.ToList();

gridControl3.DataSource = EXdates;


Updated bit query!







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 26 '18 at 12:43









Ankush MadankarAnkush Madankar

2,19132961




2,19132961













  • this error appear System.InvalidCastException: 'Unable to cast object of type 'System.Data.Entity.DynamicProxies.purchases_item_serie_E5008677EB8BFE6A32656BA94B232411B2F01DA5D79EE4F711F972E15AC739D4' to type 'System.IConvertible'.'

    – Bassem Kamal M
    Nov 26 '18 at 16:14











  • thank you , it work after changing to .Select(u => new { u.pis_ExpireDate }) thanks

    – Bassem Kamal M
    Nov 26 '18 at 16:24











  • @BassemKamalM Is it fine if I ask you to mark solution as "Answer"?

    – Ankush Madankar
    Nov 28 '18 at 8:29



















  • this error appear System.InvalidCastException: 'Unable to cast object of type 'System.Data.Entity.DynamicProxies.purchases_item_serie_E5008677EB8BFE6A32656BA94B232411B2F01DA5D79EE4F711F972E15AC739D4' to type 'System.IConvertible'.'

    – Bassem Kamal M
    Nov 26 '18 at 16:14











  • thank you , it work after changing to .Select(u => new { u.pis_ExpireDate }) thanks

    – Bassem Kamal M
    Nov 26 '18 at 16:24











  • @BassemKamalM Is it fine if I ask you to mark solution as "Answer"?

    – Ankush Madankar
    Nov 28 '18 at 8:29

















this error appear System.InvalidCastException: 'Unable to cast object of type 'System.Data.Entity.DynamicProxies.purchases_item_serie_E5008677EB8BFE6A32656BA94B232411B2F01DA5D79EE4F711F972E15AC739D4' to type 'System.IConvertible'.'

– Bassem Kamal M
Nov 26 '18 at 16:14





this error appear System.InvalidCastException: 'Unable to cast object of type 'System.Data.Entity.DynamicProxies.purchases_item_serie_E5008677EB8BFE6A32656BA94B232411B2F01DA5D79EE4F711F972E15AC739D4' to type 'System.IConvertible'.'

– Bassem Kamal M
Nov 26 '18 at 16:14













thank you , it work after changing to .Select(u => new { u.pis_ExpireDate }) thanks

– Bassem Kamal M
Nov 26 '18 at 16:24





thank you , it work after changing to .Select(u => new { u.pis_ExpireDate }) thanks

– Bassem Kamal M
Nov 26 '18 at 16:24













@BassemKamalM Is it fine if I ask you to mark solution as "Answer"?

– Ankush Madankar
Nov 28 '18 at 8:29





@BassemKamalM Is it fine if I ask you to mark solution as "Answer"?

– Ankush Madankar
Nov 28 '18 at 8:29













0














Try add this to your query:



.GroupBy(x => x.pis_ExpireDate).Distinct();





share|improve this answer
























  • This won't help at all. It will actuall make things worse. GroupBy returns IGrouping<> objects which are distinct by definition. They'll be unrecognizable by any grid configured to display row items

    – Panagiotis Kanavos
    Nov 26 '18 at 11:31











  • You can also create your own implementation of IEqualityComparer and pass it instance to Distinct() method.

    – Marcin Tyborowski
    Nov 26 '18 at 11:40











  • Which would do what? It would still return an IGrouping<T> instead fo a list of T's , that can't be mapped to any grid.

    – Panagiotis Kanavos
    Nov 26 '18 at 11:42













  • empty grid view appear , no rows created

    – Bassem Kamal M
    Nov 26 '18 at 11:56
















0














Try add this to your query:



.GroupBy(x => x.pis_ExpireDate).Distinct();





share|improve this answer
























  • This won't help at all. It will actuall make things worse. GroupBy returns IGrouping<> objects which are distinct by definition. They'll be unrecognizable by any grid configured to display row items

    – Panagiotis Kanavos
    Nov 26 '18 at 11:31











  • You can also create your own implementation of IEqualityComparer and pass it instance to Distinct() method.

    – Marcin Tyborowski
    Nov 26 '18 at 11:40











  • Which would do what? It would still return an IGrouping<T> instead fo a list of T's , that can't be mapped to any grid.

    – Panagiotis Kanavos
    Nov 26 '18 at 11:42













  • empty grid view appear , no rows created

    – Bassem Kamal M
    Nov 26 '18 at 11:56














0












0








0







Try add this to your query:



.GroupBy(x => x.pis_ExpireDate).Distinct();





share|improve this answer













Try add this to your query:



.GroupBy(x => x.pis_ExpireDate).Distinct();






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 26 '18 at 11:20









Marcin TyborowskiMarcin Tyborowski

322




322













  • This won't help at all. It will actuall make things worse. GroupBy returns IGrouping<> objects which are distinct by definition. They'll be unrecognizable by any grid configured to display row items

    – Panagiotis Kanavos
    Nov 26 '18 at 11:31











  • You can also create your own implementation of IEqualityComparer and pass it instance to Distinct() method.

    – Marcin Tyborowski
    Nov 26 '18 at 11:40











  • Which would do what? It would still return an IGrouping<T> instead fo a list of T's , that can't be mapped to any grid.

    – Panagiotis Kanavos
    Nov 26 '18 at 11:42













  • empty grid view appear , no rows created

    – Bassem Kamal M
    Nov 26 '18 at 11:56



















  • This won't help at all. It will actuall make things worse. GroupBy returns IGrouping<> objects which are distinct by definition. They'll be unrecognizable by any grid configured to display row items

    – Panagiotis Kanavos
    Nov 26 '18 at 11:31











  • You can also create your own implementation of IEqualityComparer and pass it instance to Distinct() method.

    – Marcin Tyborowski
    Nov 26 '18 at 11:40











  • Which would do what? It would still return an IGrouping<T> instead fo a list of T's , that can't be mapped to any grid.

    – Panagiotis Kanavos
    Nov 26 '18 at 11:42













  • empty grid view appear , no rows created

    – Bassem Kamal M
    Nov 26 '18 at 11:56

















This won't help at all. It will actuall make things worse. GroupBy returns IGrouping<> objects which are distinct by definition. They'll be unrecognizable by any grid configured to display row items

– Panagiotis Kanavos
Nov 26 '18 at 11:31





This won't help at all. It will actuall make things worse. GroupBy returns IGrouping<> objects which are distinct by definition. They'll be unrecognizable by any grid configured to display row items

– Panagiotis Kanavos
Nov 26 '18 at 11:31













You can also create your own implementation of IEqualityComparer and pass it instance to Distinct() method.

– Marcin Tyborowski
Nov 26 '18 at 11:40





You can also create your own implementation of IEqualityComparer and pass it instance to Distinct() method.

– Marcin Tyborowski
Nov 26 '18 at 11:40













Which would do what? It would still return an IGrouping<T> instead fo a list of T's , that can't be mapped to any grid.

– Panagiotis Kanavos
Nov 26 '18 at 11:42







Which would do what? It would still return an IGrouping<T> instead fo a list of T's , that can't be mapped to any grid.

– Panagiotis Kanavos
Nov 26 '18 at 11:42















empty grid view appear , no rows created

– Bassem Kamal M
Nov 26 '18 at 11:56





empty grid view appear , no rows created

– Bassem Kamal M
Nov 26 '18 at 11:56



Popular posts from this blog

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

Calculate evaluation metrics using cross_val_predict sklearn

Insert data from modal to MySQL (multiple modal on website)