I get this error message:
There was a problem extracting DataKeyValues from the DataSource. Please ensure that DataKeyNames are specified correctly and all fields specified exist in the DataSource.
If I do:
Select sr => it works
Select sr, s.SessionNo => it does not work
If I use Anonymous types, it doesn't work at all
Link Query:
Dim query = From sr In db.SessionReps
From s In db.Sessions Where s.ID = sr.RepID And sr.RepID = repID
From g In db.Groups Where g.ID = s.GroupID
From p In db.Programs Where p.ID = g.ProgramID
Select New With {.ProgramName = p.Name, .GroupName = g.Name, sr.Active, sr.Attended, sr.DropOutDate, sr.ConfirmDate, sr.SessionID, s.Name, s.SessionNo, s.StartDate, s.EndDate}
grdSessionReps.DataSource = query.ToList() => datasource is correct.
grdSessionReps.DataBind() ***** ERROR here!!!
ASCX file:
<Columns>
<telerik:GridBoundColumn DataField="ProgramName" HeaderText="Program Name" UniqueName="ProgramName"
ReadOnly="True">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="GroupName" HeaderText="Group Name" UniqueName="GroupName"
ReadOnly="True">
</telerik:GridBoundColumn>
<telerik:GridCheckBoxColumn DataField="Active" HeaderText="Active" ItemStyle-Width="50"
DefaultInsertValue="true" UniqueName="Active" ReadOnly="True">
<ItemStyle Width="50px"></ItemStyle>
</telerik:GridCheckBoxColumn>
<telerik:GridBoundColumn DataField="Name" HeaderText="Name" ReadOnly="True">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="SessionNo" HeaderText="Session No" ReadOnly="True">
</telerik:GridBoundColumn>
<telerik:GridDateTimeColumn DataField="StartDate" HeaderText="Start Date" ItemStyle-Width="150"
PickerType="DateTimePicker" UniqueName="StartDate" ReadOnly="True">
</telerik:GridDateTimeColumn>
<telerik:GridDateTimeColumn DataField="EndDate" HeaderText="End Date" ItemStyle-Width="150"
PickerType="DateTimePicker" UniqueName="EndDate" ReadOnly="True">
</telerik:GridDateTimeColumn>
<telerik:GridCheckBoxColumn DataField="Attended" HeaderText="Attended" ItemStyle-Width="50"
DefaultInsertValue="true" UniqueName="Active" ReadOnly="True">
<ItemStyle Width="50px"></ItemStyle>
</telerik:GridCheckBoxColumn>
<telerik:GridDateTimeColumn DataField="DropOutDate" HeaderText="DropOut Date" ItemStyle-Width="150"
PickerType="DateTimePicker" ReadOnly="True" UniqueName="DropOutDate">
</telerik:GridDateTimeColumn>
<telerik:GridDateTimeColumn DataField="ConfirmDate" HeaderText="Confirm Date" ItemStyle-Width="150"
PickerType="DateTimePicker" ReadOnly="True" UniqueName="ConfirmDate">
</telerik:GridDateTimeColumn>
</Columns>
There was a problem extracting DataKeyValues from the DataSource. Please ensure that DataKeyNames are specified correctly and all fields specified exist in the DataSource.
If I do:
Select sr => it works
Select sr, s.SessionNo => it does not work
If I use Anonymous types, it doesn't work at all
Link Query:
Dim query = From sr In db.SessionReps
From s In db.Sessions Where s.ID = sr.RepID And sr.RepID = repID
From g In db.Groups Where g.ID = s.GroupID
From p In db.Programs Where p.ID = g.ProgramID
Select New With {.ProgramName = p.Name, .GroupName = g.Name, sr.Active, sr.Attended, sr.DropOutDate, sr.ConfirmDate, sr.SessionID, s.Name, s.SessionNo, s.StartDate, s.EndDate}
grdSessionReps.DataBind() ***** ERROR here!!!
ASCX file:
<Columns>
<telerik:GridBoundColumn DataField="ProgramName" HeaderText="Program Name" UniqueName="ProgramName"
ReadOnly="True">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="GroupName" HeaderText="Group Name" UniqueName="GroupName"
ReadOnly="True">
</telerik:GridBoundColumn>
<telerik:GridCheckBoxColumn DataField="Active" HeaderText="Active" ItemStyle-Width="50"
DefaultInsertValue="true" UniqueName="Active" ReadOnly="True">
<ItemStyle Width="50px"></ItemStyle>
</telerik:GridCheckBoxColumn>
<telerik:GridBoundColumn DataField="Name" HeaderText="Name" ReadOnly="True">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="SessionNo" HeaderText="Session No" ReadOnly="True">
</telerik:GridBoundColumn>
<telerik:GridDateTimeColumn DataField="StartDate" HeaderText="Start Date" ItemStyle-Width="150"
PickerType="DateTimePicker" UniqueName="StartDate" ReadOnly="True">
</telerik:GridDateTimeColumn>
<telerik:GridDateTimeColumn DataField="EndDate" HeaderText="End Date" ItemStyle-Width="150"
PickerType="DateTimePicker" UniqueName="EndDate" ReadOnly="True">
</telerik:GridDateTimeColumn>
<telerik:GridCheckBoxColumn DataField="Attended" HeaderText="Attended" ItemStyle-Width="50"
DefaultInsertValue="true" UniqueName="Active" ReadOnly="True">
<ItemStyle Width="50px"></ItemStyle>
</telerik:GridCheckBoxColumn>
<telerik:GridDateTimeColumn DataField="DropOutDate" HeaderText="DropOut Date" ItemStyle-Width="150"
PickerType="DateTimePicker" ReadOnly="True" UniqueName="DropOutDate">
</telerik:GridDateTimeColumn>
<telerik:GridDateTimeColumn DataField="ConfirmDate" HeaderText="Confirm Date" ItemStyle-Width="150"
PickerType="DateTimePicker" ReadOnly="True" UniqueName="ConfirmDate">
</telerik:GridDateTimeColumn>
</Columns>