This is a migrated thread and some comments may be shown as answers.

databound panelbar with templates.

2 Answers 64 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Bob asked on 20 Oct 2008, 08:40 PM
Hi all,


I have the following panelbar:
            <telerik:RadPanelBar ID="RadPanelBar1" runat="server" ExpandAnimation-Type="Linear" CollapseAnimation-Type="Linear" ExpandMode="FullExpandedItem" DataSourceID="SqlDataSource1" 
                DataFieldID="id" DataFieldParentID="parentID" DataTextField="Text">  
                <DataBindings> 
                    <telerik:RadPanelItemBinding FormatString="Dept. {0}" TextField="text" Depth="0" /> 
                    <telerik:RadPanelItemBinding  FormatString="MenuItem 1 &gt; {0}" TextField="text" Depth="1" /> 
                </DataBindings> 
                <ItemTemplate> 
                hello  
                </ItemTemplate> 
                <CollapseAnimation Type="Linear" Duration="100"></CollapseAnimation> 
                <ExpandAnimation Type="Linear" Duration="100"></ExpandAnimation> 
            </telerik:RadPanelBar> 

In the template, where it says hello, what I would like to do is to have the bound data show up at the start of the line, then add imagebuttons after that data, all on the same line.

How can I do that?

Currently, it outputs my datarow, then starts a new line with what is in the template, giving me 2 lines for each datarow.  I want only 1 line of output for each datarow.

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 21 Oct 2008, 11:11 AM
Hello Bob,

Try binding a data in the ItemTemplate of the PanelBar as shown below.
cs:
<ItemTemplate>   
  <%#Eval("DataField") %>   
  <asp:ImageButton ID="ImageButton1" ImageUrl="~/image1" runat="server" />  
</ItemTemplate>  
where DataField represents the field in the DataBase.

Thanks
Princy.
0
Bob
Top achievements
Rank 1
answered on 21 Oct 2008, 02:00 PM
Yeah, I know how to do that.

I wasn't actually clear enough in my initial question.

I'll go back and edit it, however, what I get right now is:

Level 1 dataitem
level 1 dataitem  imagebutton
    level 2 dataitem
    level 2 dataitem imagebutton
    anotherone
    anotherone imagebutton

It seems to be displaying 1 line for the radpanelitembinding
   and then another line for the itemtemplate.

I only want to see 1 line, not two, per datarow.

I thought that the templateitem was the template for the radpanelitembinding, but it seems to be a template for a whole new line/section ?
Tags
PanelBar
Asked by
Bob
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Bob
Top achievements
Rank 1
Share this question
or