Hi,
I'm sure you have addressed this somewhere before, but I could not find it.
I am assigning a generic collection as the DataSource of a RadGrid control. The Items in the collection have one member which is also a generic collection which provide the children.
For Example:
The assignment looks something like this:
My goal is to display the Work Orders with the ResourceRequirement children grouped under each WorkOrderDetail line.
For Example:
WoNumber Title
000010202 Repair light fixture
ID Planned Hrs Remaining Hrs Workers
Electician 8.0 8.0 1
Welder 8.0 8.0 1
I figured out how to get the headers defined, but I currently have no content showing up for the child rows. Here is my markup:
So, my question is: how do I tell the control to use the "Resources" property of the WorkOrderDetails item to fill the content of the second level of the heirarchy?
I'm sure you have addressed this somewhere before, but I could not find it.
I am assigning a generic collection as the DataSource of a RadGrid control. The Items in the collection have one member which is also a generic collection which provide the children.
For Example:
public
class
WorkOrderDetails
{
protected
readonly
IWorkOrder _workOrder;
protected
readonly
List<ResourceRequirement> _resources =
new
List<ResourceRequirement>();
public
WorkOrderDetails(IWorkOrder wo)
{
_workOrder = wo;
foreach
(IWoResources res
in
wo.ResourcesChildren)
{
_resources.Add(
new
ResourceRequirement(res));
}
}
public
string
WoNumber {
get
{
return
_workOrder.WoNumber; } }
public
string
Title
{
get
{
return
_workOrder.Description; }
}
public
List<ResourceRequirement> Resources
{
get
{
return
_resources; }
}
}
public
class
ResourceRequirement
{
private
IResources _data;
public
ResourceRequirement(IResources res)
{
_data = res;
}
//
// Summary
// The Unique ID of this ResourceRequiment (which is a "Skill").
public string ID { get { return _data.ResourceId; } }
//
// Summary:
// The property for the planned_hours column of the TabWare database wo_resources
// table.
public
decimal
PlannedHours {
get
{
return
_data.PlannedHours; } }
//
// Summary:
// The property for the remaining_hours column of the TabWare database wo_resources
// table.
public
decimal
RemainingHours {
get
{
return
_data.RemainingHours; } }
//
// Summary:
// The property for the workers column of the TabWare database wo_resources
// table.
public
int
Workers {
get
{
return
_data.Workers; } }
}
The assignment looks something like this:
List<WorkOrderDetails> list = factory.GetWorkOrders();
RadGrid1.DataSource = list;
My goal is to display the Work Orders with the ResourceRequirement children grouped under each WorkOrderDetail line.
For Example:
WoNumber Title
000010202 Repair light fixture
ID Planned Hrs Remaining Hrs Workers
Electician 8.0 8.0 1
Welder 8.0 8.0 1
I figured out how to get the headers defined, but I currently have no content showing up for the child rows. Here is my markup:
<
telerik:RadGrid
ID
=
"rgPlannedWorkOrders"
runat
=
"server"
Width
=
"480px"
Height
=
"392px"
AutoGenerateColumns
=
"False"
AllowSorting
=
"True"
Skin
=
"Sunset"
GridLines
=
"Vertical"
CellSpacing
=
"0"
AutoGenerateHierarchy
=
"true"
>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"True"
/>
</
ClientSettings
>
<
MasterTableView
Width
=
"100%"
HierarchyDefaultExpanded
=
"True"
HierarchyLoadMode
=
"ServerBind"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"WoNumber"
FilterControlAltText
=
"Filter WoNumber column"
HeaderText
=
"WoNumber"
ReadOnly
=
"True"
SortExpression
=
"WoNumber"
UniqueName
=
"WoNumber"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Title"
FilterControlAltText
=
"Filter Title column"
HeaderText
=
"Title"
ReadOnly
=
"True"
SortExpression
=
"Title"
UniqueName
=
"Title"
>
</
telerik:GridBoundColumn
>
</
Columns
>
<
DetailTables
>
<
telerik:GridTableView
Name
=
"SubLevel1"
ShowHeadersWhenNoRecords
=
"false"
AutoGenerateColumns
=
"false"
>
<%-- This level holds items of Type2 --%>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"ID"
FilterControlAltText
=
"Filter ID column"
HeaderText
=
"ID"
ReadOnly
=
"True"
SortExpression
=
"ResourceId"
UniqueName
=
"ID"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"PlannedHours"
DataType
=
"System.Decimal"
FilterControlAltText
=
"Filter PlannedHours column"
HeaderText
=
"Planned Hrs"
ReadOnly
=
"True"
SortExpression
=
"PlannedHours"
UniqueName
=
"PlannedHours"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"RemainingHours"
DataType
=
"System.Decimal"
FilterControlAltText
=
"Filter RemainingHours column"
HeaderText
=
"Remaining Hrs"
ReadOnly
=
"True"
SortExpression
=
"RemainingHours"
UniqueName
=
"RemainingHours"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Workers"
DataType
=
"System.Int32"
FilterControlAltText
=
"Filter Workers column"
HeaderText
=
"# Workers"
ReadOnly
=
"True"
SortExpression
=
"Workers"
UniqueName
=
"Workers"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
telerik:GridTableView
>
</
DetailTables
>
<
EditFormSettings
>
<
EditColumn
FilterControlAltText
=
"Filter EditCommandColumn column"
></
EditColumn
>
</
EditFormSettings
>
<
GroupHeaderItemStyle
Height
=
"32px"
/>
<
RowIndicatorColumn
FilterControlAltText
=
"Filter RowIndicator column"
></
RowIndicatorColumn
>
<
ExpandCollapseColumn
FilterControlAltText
=
"Filter ExpandColumn column"
></
ExpandCollapseColumn
>
</
MasterTableView
>
<
GroupingSettings
GroupContinuesFormatString
=
""
GroupContinuedFormatString
=
""
></
GroupingSettings
>
<
FilterMenu
EnableImageSprites
=
"False"
></
FilterMenu
>
<
HeaderContextMenu
CssClass
=
"GridContextMenu GridContextMenu_Sunset"
></
HeaderContextMenu
>
</
telerik:RadGrid
>
So, my question is: how do I tell the control to use the "Resources" property of the WorkOrderDetails item to fill the content of the second level of the heirarchy?