Hi,
I've run across a problem when populating a Panel bar using a List as the datasource. The problem occurs when I try to set the DataTextField property of the PanelBar to the property of a child object which resides in my List. Here is a code sample (btw, I am creating the List from a Linq query, but I don't think that should matter):
When I call DataBind() I receive this error: "Object of type Menu.MenuItem does not have a MenuItemDisplayName.DisplayName property."
When I look at the PanelBar DataSource in the debugger I can see that I do indeed have my array of MenuItem objects, and within each MenuItem object there is a MenuItemDisplayName object with a DisplayName property.
It's seems what I'm trying to do is pretty straight forward and when I try this with a RadGrid the code works fine and I do not receive any errors.
Does anyone have an idea of what I may be doing wrong?
Thanks, -Scott
I've run across a problem when populating a Panel bar using a List as the datasource. The problem occurs when I try to set the DataTextField property of the PanelBar to the property of a child object which resides in my List. Here is a code sample (btw, I am creating the List from a Linq query, but I don't think that should matter):
| <telerik:RadPanelBar ID="MenuPanelBar" Skin="WebBlue" Runat="server"> |
| </telerik:RadPanelBar> |
| LayoutFrameworkDataContext dc = new LayoutFrameworkDataContext(); MenuPanelBar.DataSource = |
| (from mi in dc.MenuItems |
| from mid in dc.MenuItemDisplayNames |
| where mi.DisplayNameID == mid.DisplayID |
| select mi).ToList(); |
| MenuPanelBar.DataTextField = "MenuItemDisplayName.DisplayName"; |
| MenuPanelBar.DataBind(); |
When I call DataBind() I receive this error: "Object of type Menu.MenuItem does not have a MenuItemDisplayName.DisplayName property."
When I look at the PanelBar DataSource in the debugger I can see that I do indeed have my array of MenuItem objects, and within each MenuItem object there is a MenuItemDisplayName object with a DisplayName property.
It's seems what I'm trying to do is pretty straight forward and when I try this with a RadGrid the code works fine and I do not receive any errors.
Does anyone have an idea of what I may be doing wrong?
Thanks, -Scott