I have been attempting to get a detail table working connecting through a LINQ data source in a Grid. When I attempt to expand the detail table, the ID for the SelectParameter is being passed through as null. Does anyone know why this might be happening?
ASPX code:
Data Source Selecting Code:
Any help would be greatly appreciated!
ASPX code:
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"rgFacilities"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"rgFacilities"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadGrid
DataSourceID
=
"ldsFacilities"
AutoGenerateColumns
=
"false"
AllowPaging
=
"True"
PageSize
=
"20"
AllowSorting
=
"True"
ID
=
"rgFacilities"
runat
=
"server"
>
<
MasterTableView
DataKeyNames
=
"FacilityID"
DataSourceID
=
"ldsFacilities"
AllowMultiColumnSorting
=
"False"
GroupLoadMode
=
"Server"
>
<
DetailTables
>
<
telerik:GridTableView
DataKeyNames
=
"EquipmentID"
DataSourceID
=
"ldsEquipment"
Width
=
"100%"
runat
=
"server"
AutoGenerateColumns
=
"true"
>
<
ParentTableRelation
>
<
telerik:GridRelationFields
DetailKeyField
=
"FacilityID"
MasterKeyField
=
"FacilityID"
/>
</
ParentTableRelation
>
</
telerik:GridTableView
>
</
DetailTables
>
<
Columns
>
<
telerik:GridBoundColumn
SortExpression
=
"Name"
HeaderText
=
"Facility Name"
DataField
=
"Name"
UniqueName
=
"Name"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
SortExpression
=
"City"
HeaderText
=
"City"
DataField
=
"City"
UniqueName
=
"City"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
SortExpression
=
"Region"
HeaderText
=
"State/Province"
DataField
=
"Region"
UniqueName
=
"Region"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
SortExpression
=
"Country"
HeaderText
=
"Country"
DataField
=
"Country"
UniqueName
=
"Country"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
SortExpression
=
"Description"
HeaderText
=
"Description"
DataField
=
"Description"
UniqueName
=
"Description"
AllowSorting
=
"false"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
<
asp:LinqDataSource
ID
=
"ldsFacilities"
OnSelecting
=
"ldsFacilities_Selecting"
runat
=
"server"
>
</
asp:LinqDataSource
>
<
asp:LinqDataSource
ID
=
"ldsEquipment"
OnSelecting
=
"ldsEquipment_Selecting"
runat
=
"server"
>
<
SelectParameters
>
<
asp:SessionParameter
Name
=
"FacilityID"
SessionField
=
"FacilityID"
/>
</
SelectParameters
>
</
asp:LinqDataSource
>
Data Source Selecting Code:
protected
void
ldsFacilities_Selecting(
object
sender, LinqDataSourceSelectEventArgs e)
{
Data.EcofitDataContext db =
new
Data.EcofitDataContext();
e.Result = (from f
in
db.Facilities
select f);
}
protected
void
ldsEquipment_Selecting(
object
sender, LinqDataSourceSelectEventArgs e)
{
Data.EcofitDataContext db =
new
Data.EcofitDataContext();
e.Result = (from eq
in
db.Equipments
where eq.FacilityID == Guid.Parse(e.SelectParameters[
"FacilityID"
].ToString())
select eq);
}
Any help would be greatly appreciated!