Databound RadPanelItem with control in the Header

6 posts, 1 answers
  1. jeremy
    jeremy avatar
    2 posts
    Member since:
    Jun 2007

    Posted 08 Jun 2009 Link to this post

    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!
  2. Answer
    Paul
    Admin
    Paul avatar
    4281 posts

    Posted 12 Jun 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. jeremy
    jeremy avatar
    2 posts
    Member since:
    Jun 2007

    Posted 15 Jun 2009 Link to this post

    Perfect!  Thanks.
  5. Rathgeber Stephane
    Rathgeber Stephane avatar
    2 posts
    Member since:
    Oct 2009

    Posted 05 Oct 2009 Link to this post

    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
                        { 
                             
                        } 
                    } 
                } 
            } 




  6. T. Tsonev
    Admin
    T. Tsonev avatar
    2770 posts

    Posted 09 Oct 2009 Link to this post

    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.
  7. Rathgeber Stephane
    Rathgeber Stephane avatar
    2 posts
    Member since:
    Oct 2009

    Posted 15 Oct 2009 Link to this post

    Thanks.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017