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

Databound RadPanelItem with control in the Header

5 Answers 213 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
jeremy
Top achievements
Rank 1
jeremy asked on 08 Jun 2009, 09:54 PM

I have created a RadPanelBar that is databound to an object.  I want to add a button in the header part of each RadPanelItem simliar to this http://www.telerik.com/community/forums/aspnet-ajax/panelbar/add-control-to-panelbar-header.aspx. I tried the suggested solution from that post, but the problem I am having is that the image/button is rendering behind the header instead of on top of it.  All the examples that I have seen that work are using static RadPanelItems instead of dynamically created ones.

Here is some example code:

<telerik:RadPanelBar ID="rpb_Filters" 
                                 ExpandMode="FullExpandedItem" 
                                 Height="700px" 
                                 runat="server" 
                                 Skin="Vista" 
                                 Width="490px">  
                         
                <ItemTemplate> 
                    <asp:Image ID="img_URL"   
                               ImageUrl="add_16.png" 
                               runat="server" 
                               ToolTip="Add Child Category" /> 
                </ItemTemplate> 
 
            </telerik:RadPanelBar> 

and here is how I am setting the datasource
'Set the Datasource  
            rpb_Filters.DataSource = Filters  
            rpb_Filters.DataFieldID = "FilterID" 
            rpb_Filters.DataFieldParentID = "ParentFilterID" 
            rpb_Filters.DataTextField = "FilterName" 
            rpb_Filters.DataBind()  
 
            'Expand the first filter  
            rpb_Filters.Items(0).Expanded = True 

Thanks!

5 Answers, 1 is accepted

Sort by
0
Accepted
Paul
Telerik team
answered on 12 Jun 2009, 12:23 PM
Hi jeremy,

Please find below your modified code snippet that should work as expected. Let us know how it goes.

<html xmlns="http://www.w3.org/1999/xhtml">    
 
<head runat="server">    
    <style type="text/css">    
        div.RadPanelBar .rpItem    
        {    
            position: relative;    
        }    
    </style>   
</head>   
<body>   
    <form id="form1" runat="server">    
    <asp:ScriptManager ID="ScriptManager1" runat="server" />   
    <telerik:RadPanelBar ID="rpb_Filters"    
                                 ExpandMode="FullExpandedItem"    
                                 Height="700px"    
                                 runat="server"    
                                 Skin="Vista"    
                                 Width="490px">     
                            
                <ItemTemplate>    
        <div style="position: absolute; top: 1px; left: 210px">    
                    <asp:Image ID="img_URL"      
                               ImageUrl="add_16.png"    
                               runat="server"    
                               ToolTip="Add Child Category" />    
                   </div>   
                </ItemTemplate>    
            </telerik:RadPanelBar>   
    </form>   
</body>   
</html>   
 


Regards,
Paul
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
jeremy
Top achievements
Rank 1
answered on 15 Jun 2009, 08:17 PM
Perfect!  Thanks.
0
Rathgeber Stephane
Top achievements
Rank 1
answered on 05 Oct 2009, 01:59 PM
Hello,

I used this method to add a checkbox, I must still play with the CSS, but it works.

I can't get the boxes status.

private void listeFg(DataTable data,string nomClient) 
        { 
            lblOrdre.Text = nomClient; 
            RadPanelBarFG.Items.Clear(); 
            foreach (DataRow row in data.Rows) 
            { 
                RadPanelItem commandeItem = new RadPanelItem(); 
 
                CheckBox affectation = new CheckBox(); 
 
                affectation.ID = "checkbox_" + row["NUMCMDE"].ToString();                
                affectation.CssClass = "chexBoxPos"
 
                commandeItem.Controls.Add(affectation); 
                commandeItem.Expanded = false
                commandeItem.Text = String.Format(@"
                    <table class='titreCommande'><tr>
                    <td class='numCommande'>Commande n° {0}</td>
                    <td class='numCommande'>{1}</td>
                    </table>" 
                    , row["NUMCMDE"].ToString(), row["SZMODELE"].ToString()); 
                 
                TableITemplate template = new TableITemplate("detailCommande"); 
 
                template.addValue("Modèle : "); 
                template.addValue(row["SZMODELE"].ToString()); 
                template.addValue("Surestimation Reprise TTC : "); 
                template.addValue(row["FSURESTIMATIONREPVO"].ToString()); 
                template.newRow(); 
                template.addValue("Prix Tarif TTC : "); 
                template.addValue(row["FMONTANTCATALOGUE"].ToString()); 
                template.addValue("Type d'intermédiaire : "); 
                template.addValue(row["SZTYPEINTERMEDIAIRE"].ToString()); 
                template.newRow(); 
                template.addValue("Remise TTC : "); 
                template.addValue(row["FMONTANTREMISE"].ToString()); 
                template.addValue("Option TTC : "); 
                template.addValue(row["FMONTANTOPTIONS"].ToString()); 
                template.newRow(); 
                 
                RadPanelItem detailCommande = new RadPanelItem(); 
                detailCommande.ItemTemplate = template; 
 
                commandeItem.Items.Add(detailCommande); 
 
                RadPanelBarFG.Items.Add(commandeItem); 
            } 
        } 


protected void assignationFg(object sender, EventArgs e) 
        { 
           // CheckBox MyCheckBox = (CheckBox)FindControl("checkbox_000001"); 
            
            foreach (RadPanelItem panelitem in RadPanelBarFG.GetAllItems()) 
            { 
                if (panelitem.Level == 1) 
                { 
                    CheckBox cbCmd = (CheckBox)panelitem.FindControl("checkbox"); 
                    if (cbCmd != null
                    { 
                         
                    } 
                } 
            } 
        } 




0
T. Tsonev
Telerik team
answered on 09 Oct 2009, 01:42 PM
Hello,

Having different item templates can get a little tricky, so I've prepared you a little sample that you can use as a reference.

The idea is to disable the ViewState and recreate the items on each page load. This way we can control the template that gets assigned to each node even after postback.

Greetings,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Rathgeber Stephane
Top achievements
Rank 1
answered on 15 Oct 2009, 07:56 AM
Thanks.
Tags
PanelBar
Asked by
jeremy
Top achievements
Rank 1
Answers by
Paul
Telerik team
jeremy
Top achievements
Rank 1
Rathgeber Stephane
Top achievements
Rank 1
T. Tsonev
Telerik team
Share this question
or