Hello,
I am trying to databind a RadPanelBar (2010 Q2 release) to achieve a specific behavior, and I am having trouble getting it to work.
If I have the panelbar in my aspx like so:
And code-behind like so:
Then what I get is a PanelBar that works correctly, but the items are not collapsible. I have read in various places that I should add RadPanelItem and add a ContentTemplate and put my template there.
If I move the aspx template code, like so:
And leave my codebehind the same, then I get collapsed elements that won't expand.
I have traced into the databound procedure under this second scenario, and when it binds e.item is a RadPanelBarItem that has no child items or controls, so the e.item.findcontrol("txtRel") returns nothing.
I feel like I must be binding something wrong somewhere, but I am not sure how to accomplish what I want.
Ideally, I will get PanelBarItems that have their text set to "Name", and have a textbox "under" them, that can be shown or hidden by clicking on the panelbar. The first example gets me everything except the ability to collapse them.
Is it possible to do what I want?
Josh
I am trying to databind a RadPanelBar (2010 Q2 release) to achieve a specific behavior, and I am having trouble getting it to work.
If I have the panelbar in my aspx like so:
<telerik:RadPanelBar ID="rpbRel" runat="server" OnItemDataBound="rpbRel_ItemDataBound" > <ItemTemplate> <div class="DestinationWrapperBox"> <asp:TextBox runat="server" id="txtRel" /> </div> </ItemTemplate></telerik:RadPanelBar>And code-behind like so:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim colTypes As System.Collections.ObjectModel.Collection(Of RelationshipType) rpbRel.DataSource = colTypes rpbRel.DataTextField = "Name" rpbRel.DataValueField = "ID" rpbRel.DataBind()End SubProtected Sub rpbRelationships_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadPanelBarEventArgs) Dim oRelType As RelationshipType Dim txtTemp As TextBox oRelType = CType(e.Item.DataItem, RelationshipType) txtTemp = CType(e.Item.FindControl("txtRel"), TextBox) If Not IsNothing(txtTemp) Then txtTemp.Text = oRelType.Name End IfEnd SubThen what I get is a PanelBar that works correctly, but the items are not collapsible. I have read in various places that I should add RadPanelItem and add a ContentTemplate and put my template there.
If I move the aspx template code, like so:
<telerik:RadPanelBar ID="rpbRel" runat="server" OnItemDataBound="rpbRel_ItemDataBound" > <Items> <telerik:RadPanelItem runat="server"> <ContentTemplate> <div class="DestinationWrapperBox"> <asp:TextBox runat="server" id="txtRel" /> </div> </ContentTemplate> </telerik:RadPanelItem> </Items></telerik:RadPanelBar>And leave my codebehind the same, then I get collapsed elements that won't expand.
I have traced into the databound procedure under this second scenario, and when it binds e.item is a RadPanelBarItem that has no child items or controls, so the e.item.findcontrol("txtRel") returns nothing.
I feel like I must be binding something wrong somewhere, but I am not sure how to accomplish what I want.
Ideally, I will get PanelBarItems that have their text set to "Name", and have a textbox "under" them, that can be shown or hidden by clicking on the panelbar. The first example gets me everything except the ability to collapse them.
Is it possible to do what I want?
Josh