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


2 Answers 50 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Darren166 asked on 04 Jul 2008, 06:27 PM

I have implemented my own hierarchicaldatasource and when bound to the RadTreeView it works as expected.

However I have also implemented HierarchicalDataSourceDesigner so that I can place the datasource on a page visually.  The Microsoft Tree component picks this up and can list members no problem, but the RadTreeView does not even see the datasource.  If I manually type the DataSourceId in the designer and manually enter the bindings into the property box of radTreeView, the page will work as expected, but the design component reports an error that datarowview does not contain any of the property names I typed in.

It seems that RadTreeView does not recognise the custom hierarchical datasource in design mode but uses it ok when the page is running.

Is there anything I can do to get this working in design mode?



2 Answers, 1 is accepted

Sort by
Atanas Korchev
Telerik team
answered on 07 Jul 2008, 07:58 AM
Hi Darren166,

Could you please open a support ticket and send us the source code of your datasource designer? Our development team would test against it and see where the problem is. Thanks.

the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Top achievements
Rank 1
answered on 10 Jul 2008, 01:29 AM

Hi, Albert

The label text is rendered on the page.

I tried out that it is caused by adding HtmlGenericControl in NodeDataBound event.

here is page code:

        <telerik:RadTreeView ID="treStudyArea" runat="server" Height="500px" Width="400px" EnableViewState="true"  OnNodeDataBound="databound">  
                 <asp:Label ID="Label1" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "Status") %>'></asp:Label> 
        <asp:HiddenField ID="hdnStudyAreaID" runat="server" Value="" /> 
        <asp:UpdatePanel ID="up" runat="server" UpdateMode="Conditional">  
                <asp:Label ID="Label2" runat="server" Text="ll"></asp:Label> 
        <asp:Button ID="Button1" runat="server" Text="Test" OnClick="btn_serverclick" /> 

here is the Databound code:

    protected void databound(object sender, RadTreeNodeEventArgs e)  
        RadTreeNode node = e.Node;  
        DataRowView dataItem = node.DataItem as DataRowView;  
        HtmlGenericControl rdButton = new HtmlGenericControl("input");  
        rdButton.Attributes.Add("type", "radio");  
        rdButton.Attributes.Add("name", "studyAreaGroup");  
        rdButton.Attributes.Add("value", dataItem["Id"].ToString());  
        rdButton.Attributes.Add("saType", dataItem["Type"].ToString());  
        rdButton.InnerHtml = dataItem["Name"].ToString();  
        rdButton.ID = "rdButton";  
        //rdButton.EnableViewState = true;  
        node.Value = dataItem["Id"].ToString();  
        if (dataItem["Status"].ToString().Equals("I"))  
            node.ToolTip = "Inactive";  
            node.Style.Add("color", "#D3D3D3");  
        node.EnableViewState = true;  

here is button click code:

    protected void btn_serverclick(object sender, EventArgs arg)  
        RadTreeNode node1 = this.treStudyArea.SelectedNode;  
        this.Label2.Text = (node1.Controls[1] as Label).Text;  

Thank you
PeiQi Ge
Asked by
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Top achievements
Rank 1
Share this question