DataBinding and Templated Controls

3 posts, 0 answers
  1. Gene
    Gene avatar
    64 posts
    Member since:
    Dec 2007

    Posted 27 May 2009 Link to this post

    I have a PanelBar that has many controls embedded into the templates.  I'm having trouble getting to the databound events of the templated controls.

    As an example, I have the following Panel Bar item with a treeview that has an onNodeDataBoundEvent
    1 <telerik:RadPanelBar ID="RadPanelBar1" runat="server">  
    2     <Items> 
    3         <telerik:RadPanelItem runat="server" Text="OUTPUT COLUMNS">  
    4             <Items> 
    5                 <telerik:RadPanelItem Value="OutputColumns" runat="server">  
    6                     <ItemTemplate> 
    7                         <telerik:RadTreeView ID="OutputColumnsRadTreeView" runat="server" CheckBoxes="True" 
    8                             Height="280px" TriStateCheckBoxes="True" CheckChildNodes="True" Skin="Vista" OnNodeDataBound="OutputColumnsRadTreeView_NodeDataBound">  
    9                         </telerik:RadTreeView> 
    10                     </ItemTemplate> 
    11                 </telerik:RadPanelItem> 
    12             </Items> 
    13         </telerik:RadPanelItem> 
    14     </Items> 
    15 </telerik:RadPanelBar> 

    However, when I bind:
    1  protected void Page_Load(object sender, EventArgs e)  
    2  {  
    3         RadTreeView OutputColumnsRadTreeView = (RadTreeView)QueryPanelBar.FindItemByValue("OutputColumns").FindControl("OutputColumnsRadTreeView")  
    4  
    5         OutputColumnsRadTreeView.LoadContentFile("~/App_Data/QueryOutputColumns.xml");  
    6         OutputColumnsRadTreeView.DataBind();  
    7

    The event is never fired:
    1 protected void SortColumnsRadTreeView_NodeDataBound(object sender, RadTreeNodeEventArgs e)  
    2 {  
    3         //do something here  
    4

    thanks in advance.
    Gene.
  2. Gene
    Gene avatar
    64 posts
    Member since:
    Dec 2007

    Posted 29 May 2009 Link to this post

    I figured out it wasn't the Templated control that was the problem.  It was that I'm loading xml instead of setting the datasource.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 01 Jun 2009 Link to this post

    Hello Gene,

    I'm glad that you could find the solution.  If you have any other difficulties or questions, please write to us again. 

    Best wishes,
    Yana
    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.
Back to Top