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

HierarchicaldataSourceDesigner

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

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?

Thanks,

Darren

2 Answers, 1 is accepted

Sort by
0
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.

Regards,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
PeiQi
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">  
              
            <NodeTemplate> 
                 <asp:Label ID="Label1" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "Status") %>'></asp:Label> 
                 
            </NodeTemplate> 
              
        </telerik:RadTreeView> 
              
          
        <asp:HiddenField ID="hdnStudyAreaID" runat="server" Value="" /> 
          
          
        <asp:UpdatePanel ID="up" runat="server" UpdateMode="Conditional">  
            <ContentTemplate> 
                <asp:Label ID="Label2" runat="server" Text="ll"></asp:Label> 
            </ContentTemplate>          
        </asp:UpdatePanel> 
          
          
        <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.Controls.Add(rdButton);  
 
        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;  
 
        this.up.Update();  
    } 


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