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

[Solved] Prometheus RadTreeView inside of a RadPanelBar

3 Answers 171 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 2
Markus asked on 27 Dec 2007, 09:10 AM
Hello everybody!

I would like to place a Prometheus RadTreeView inside of a Panelbar:

<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<%@ Register assembly="RadPanelbar.Net2" namespace="Telerik.WebControls" tagprefix="rad" %>
<rad:RadPanelbar ID="RadPanelbar1" Runat="server" Skin="Outlook">
                                <Items>
                                    <rad:RadPanelItem runat="server" Text="view1">
                                        <ItemTemplate>
                                            <telerik:RadTreeView ID="RadTreeView1" Runat="server">
                                            </telerik:RadTreeView>
                                        </ItemTemplate>
                                    </rad:RadPanelItem>
                                    <rad:RadPanelItem runat="server" Text="view2">
                                    </rad:RadPanelItem>
                                    <rad:RadPanelItem runat="server" Text="view3">
                                    </rad:RadPanelItem>
                                </Items>
                            </rad:RadPanelbar>

If I try to access "RadTreeView1" from my code-behind class I encounter a Nullpointerexception. The same code works fine if I'am using a Telerik.Webcontrols.RadTreeView, which avoids using ServerSideCallback for lazy loading of my tree.

Is it possible to place a Prometheus component inside of a RadControl for ASP.net ?

thx in advance

3 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 27 Dec 2007, 01:53 PM
Hi Markus,

I have prepared a sample page demonstrating how to use RadTreeView "Prometheus" inside RadPanelbar "Classic". Please let us know if you still experience problems.

Regards,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Markus
Top achievements
Rank 2
answered on 27 Dec 2007, 02:31 PM
Hi Albert!
The example you came up with works fine, but I still wonder why. Obviously the main difference is that you don't use an additional .designer.aspx partial class. I'm pretty new to ASP.net (came from J2EE/JSF). Is it still possible to access the control in the code-behind class?

An hour ago, I reinstalled the Prometheus Tools, probably this solved the problem too. What bothers me now is that there is no Prometheus Toolbox anymore in my toobox window.

edit: If I use a RadTreeView inside of the Panel, I can't access the Treeview in Designermode
0
Atanas Korchev
Telerik team
answered on 27 Dec 2007, 02:46 PM
Hello Markus,

By default controls which are defined in templates are not accessible from codebehind. Maybe this is the reason you were getting NullReferenceExceptions. To obtain instance to some control you need to use the FindControl method of its container. Here is a quick example:

RadTreeView treeView = (RadTreeView)RadPanelbar1.Items[0].Items[0].FindControl("RadTreeView1");

Regards,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
TreeView
Asked by
Markus
Top achievements
Rank 2
Answers by
Atanas Korchev
Telerik team
Markus
Top achievements
Rank 2
Share this question
or