RadPanel ItemTemplate won't collapse

2 posts, 0 answers
  1. Web Services
    Web Services avatar
    243 posts
    Member since:
    Apr 2008

    Posted 03 Aug 2009 Link to this post

    I have a rad panel that I have put a rad tree view in. However, now that the rad tree is within the panel, I cannot get it to collapse. It is always expanded and won't collapse even if you click the button. The two other panels have static data in them and they collapse fine. Can anyone help me with this issue? Here is my code

    <%@ Master Language="VB" AutoEventWireup="false" Debug="True" %>

    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <%@ import namespace="System.Data" %>
    <%@ import namespace="System.Data.Sql" %>
    <%@ import namespace="System.Data.SqlClient" %>
    <%@ import namespace="Telerik.Web.UI" %>

    <script runat="server">
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If Not Page.IsPostBack Then
                Dim tree As RadTreeView = DirectCast(RadPanelBar1.Items(0).FindControl("RadTreeView1"), RadTreeView)
                'here is where the error is. it is saying that
                'createtable is null
                tree.DataSource = CreateTable()
                tree.DataFieldID = "ID"
                tree.DataFieldParentID = "ParentID"
                tree.DataTextField = "Text"
            End If
        End Sub 'page_load
        'this function creates a datatable for the rad
        'tree that is in the events panel
        Private Function CreateTable() As DataTable
            'set up my connection to the database
            Dim conn As New SqlConnection
            conn.ConnectionString = ConfigurationManager.ConnectionStrings("connectionString").ConnectionString

            Dim table As DataTable = New DataTable()

            'this is a counter for the id fields
            'of the data table
            Dim count As Integer = 1
            'this adds the parent categories to the
            Dim categoryQuery As New SqlCommand
            categoryQuery.Connection = conn
            categoryQuery.CommandText = "select CategoryId, Name from categories"
            Dim cdr As SqlDataReader = categoryQuery.ExecuteReader()
            While cdr.Read()
                If (cdr.Item(0).ToString <> "") Then
                    table.Rows.Add(New String() {count.ToString, Nothing, cdr.Item(1).ToString})
                    'we have to increment count to keep an id for the data table
                    count = count + 1
                End If
            End While 'while cdr.Read()
            'this adds the events with their parent category
            'id to the datatable
            Dim eventQuery As New SqlCommand
            eventQuery.Connection = conn
            eventQuery.CommandText = "SELECT eventid, FK_CategoryID, name from events"
            Dim edr As SqlDataReader = eventQuery.ExecuteReader()
            While edr.Read()
                If (edr.Item(0).ToString <> "") Then
                    table.Rows.Add(New String() {count.ToString(), edr.Item(1).ToString, edr.Item(2).ToString})
                    'we have to increment count to keep an id for the data table
                    count = count + 1
                End If
            End While 'while edr.Read()
            Return table

        End Function 'CreateGenreTable


    <head runat="server">
        <asp:ContentPlaceHolder ID="head" runat="server">
        <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <telerik:RadPanelBar ID="RadPanelBar1" runat="server" Skin="Web20" ExpandMode="SingleExpandedItem">
            <CollapseAnimation Type="None" Duration="100"></CollapseAnimation>
                <telerik:RadPanelItem runat="server" Text="Events">
                        <telerik:RadTreeView ID="RadTreeView1" runat="server" Skin="Web20">
                            <CollapseAnimation Type="OutQuint" Duration="100"></CollapseAnimation>
                            <ExpandAnimation Duration="100"></ExpandAnimation>
                <telerik:RadPanelItem runat="server" Text="Calendar">
                        <telerik:RadPanelItem runat="server" Text="Child RadPanelItem 1">
                        <telerik:RadPanelItem runat="server" Text="Child RadPanelItem 2">
                <telerik:RadPanelItem runat="server" Text="Root RadPanelItem3">
                        <telerik:RadPanelItem runat="server" Text="Child RadPanelItem 1">
                        <telerik:RadPanelItem runat="server" Text="Child RadPanelItem 2">
            <ExpandAnimation Type="None" Duration="100"></ExpandAnimation>
            <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

    In case you want to see what I'm trying to do. You can go here

  2. Veselin Vasilev
    Veselin Vasilev avatar
    2992 posts

    Posted 05 Aug 2009 Link to this post


    Please check this forum post - I believe it will answer your question.

    Veselin Vasilev
    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. DevCraft R3 2016 release webinar banner
Back to Top