I am binding a Panel bar to hierarchical data following way. I do get panel bar populated with hierarchy.
.DataSource = CategoryCollection.ToList
.DataTextField = "Name"
.DataNavigateUrlField = ""
.DataFieldID = "Id"
.DataFieldParentID = "ParentId"
.DataBind()
In Item click event I want to know the value of Id and parentId of clicked item. I was trying to do following way but I am getting value nothing.
e.Item.Attributes("Id").ToString. I need to know if selected item is a parent Item or a child item. If it's child item then load user control.
What I am trying to do is when user click on a panel item show a user control with data populated for selected panel item. I do need to pass Id and a parentId on item click to pass to this user control.
I am trying to load user control on item click event. Is this a good approach? I don’t want to load user controls for all the panel items.