I put together a grid of categories that are self referencing which worked like expected. How I need to add in a detail table of products that could be associated with any level of the existing hierarchy. Please see the following for an example hierarchy:
Category 1
Category 1a
Category 1b
Category 1b1
Products for category 1b1
Category 2
Category 2a
Products for category 2a
Category 3
I am having issues adding the detail information. When I select to expand hierarchy from the main list of categories, nothing happens. None of the child categories appear and none of the products appear.
Could someone take a quick look at the above code and let me know where my logic when wrong. I looked at similar forums but was unable to find what I was overlooking. Any assistance would be greatly appreciated.
Thanks!
Category 1
Category 1a
Category 1b
Category 1b1
Products for category 1b1
Category 2
Category 2a
Products for category 2a
Category 3
I am having issues adding the detail information. When I select to expand hierarchy from the main list of categories, nothing happens. None of the child categories appear and none of the products appear.
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
Skin
=
"Web20"
OnItemCreated
=
"RadGrid1_ItemCreated"
OnItemDataBound
=
"RadGrid1_ItemDataBound"
OnColumnCreated
=
"RadGrid1_ColumnCreated"
AutoGenerateColumns
=
"False"
ShowStatusBar
=
"True"
CellSpacing
=
"0"
GridLines
=
"None"
AllowAutomaticInserts
=
"True"
>
<
HeaderContextMenu
CssClass
=
"GridContextMenu GridContextMenu_Default"
></
HeaderContextMenu
>
<
MasterTableView
DataKeyNames
=
"CATEGORY_CDE, PARENT_CDE"
ShowHeader
=
"true"
HierarchyDefaultExpanded
=
"false"
AllowSorting
=
"true"
CommandItemDisplay
=
"Bottom"
editmode
=
"InPlace"
InsertItemDisplay
=
"Bottom"
>
<
SelfHierarchySettings
KeyName
=
"CATEGORY_CDE"
ParentKeyName
=
"PARENT_CDE"
/>
<
DetailTables
>
<
telerik:GridTableView
runat
=
"server"
DataKeyNames
=
"Category_Cde,Product_Cde"
DataMember
=
"ProductList"
>
<
ParentTableRelation
>
<
telerik:GridRelationFields
DetailKeyField
=
"Category_Cde"
MasterKeyField
=
"Category_Cde"
/>
</
ParentTableRelation
>
<
CommandItemSettings
ExportToPdfText
=
"Export to PDF"
/>
<
EditFormSettings
>
<
EditColumn
FilterControlAltText
=
"Filter EditCommandColumn column"
>
</
EditColumn
>
</
EditFormSettings
>
</
telerik:GridTableView
>
</
DetailTables
>
<
CommandItemSettings
ExportToPdfText
=
"Export to PDF"
AddNewRecordText
=
"Add New Category"
></
CommandItemSettings
>
<
Columns
>
<
telerik:GridExpandColumn
FilterControlAltText
=
"Filter ExpandColumn column"
Visible
=
"True"
>
</
telerik:GridExpandColumn
>
<
telerik:GridBoundColumn
DataField
=
"Category_Cde"
UniqueName
=
"Category_Cde"
Visible
=
"true"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Parent_cde"
UniqueName
=
"Parent_cde"
Visible
=
"true"
>
</
telerik:GridBoundColumn
>
</
Columns
>
<
EditFormSettings
>
<
EditColumn
FilterControlAltText
=
"Filter EditCommandColumn column"
></
EditColumn
>
</
EditFormSettings
>
</
MasterTableView
>
<
ClientSettings
AllowExpandCollapse
=
"true"
/>
<
FilterMenu
EnableImageSprites
=
"False"
></
FilterMenu
>
</
telerik:RadGrid
>
Protected
Sub
RadGrid1_NeedDataSource(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridNeedDataSourceEventArgs)
Handles
RadGrid1.NeedDataSource
bindRadDataGrid()
End
Sub
Sub
bindRadDataGrid()
Dim
db
As
New
WebCatVB.category
categoryListInfo = db.GetCategoryList()
RadGrid1.DataSource = categoryListInfo
End
Sub
Protected
Sub
RadGrid1_DetailTableDataBind(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridDetailTableDataBindEventArgs)
Handles
RadGrid1.DetailTableDataBind
Dim
parentItem
As
GridDataItem =
CType
(e.DetailTableView.ParentItem, GridDataItem)
If
parentItem.Edit
Then
Return
End
If
If
(e.DetailTableView.DataMember =
"ProductList"
)
Then
Dim
db
As
New
WebCatVB.product
Dim
dataItem
As
GridDataItem =
CType
(e.DetailTableView.ParentItem, GridDataItem)
Dim
cat
As
String
= dataItem.GetDataKeyValue(
"CATEGORY_CDE"
).ToString()
e.DetailTableView.DataSource = db.GetProductList(cat)
End
If
End
Sub
Could someone take a quick look at the above code and let me know where my logic when wrong. I looked at similar forums but was unable to find what I was overlooking. Any assistance would be greatly appreciated.
Thanks!