I have a grouped LINQ query with a count summary line that I am binding to a gridview but the count field in the gridview just shows ‘System.Data.DataRow[]’
What am I doing wrong here? Thanks!
aspx:
<asp:BoundField DataField="Service_Name" HeaderText="Impacted services"/>
<asp:BoundField DataField="Fieldname" HeaderText="Count"/>
vb code:
Dim Services = From Lines In dtMain _
Where Lines.Field(Of String)("ULTIMATE_PARENT_NAME") = lstUPs.SelectedItem.ToString _
Group By Parent_Name = Lines.Field(Of String)("ULTIMATE_PARENT_NAME"), _
Service_Name = Lines.Field(Of String)("THIRD_PARTY_SERVICE_CLEAN") _
Into Fieldname = Group, Count()
grdOuterGridView.DataSource = Services
grdOuterGridView.DataBind()
I’m not an expert on that syntax (I use the extension methods) but it looks to me like
Fieldnameis being assigned the valueGroup, or the collection of rows that are being grouped onParent_NameandService_Name. Perhaps you need to define a field name for the result ofCount()?ETA: Got it. You should say
Group.Count(), notGroup, Count().