How to hide data fields

2 posts, 0 answers
  1. John
    John avatar
    24 posts
    Member since:
    Jan 2011

    Posted 25 Apr 2012 Link to this post

    I've got a RadTreeList but it's showing every thing including the ID and ParentID fields. How do I hide them?

    Also, it is showing my URL field. How do I set the DataNavigateUrlField property so they work properly?


    <telerik:RadTreeList ID="RadTreeList1" runat="server" ParentDataKeyNames="ParentID" DataKeyNames="ID" DataNavigateUrlField="WebAddress">
                <telerik:TreeListBoundColumn DataField="Title" UniqueName="Title" HeaderText="Title" Visible="False" Display="False"/>
                <telerik:TreeListBoundColumn DataField="WebAddress" UniqueName="WebAddress" HeaderText="" Visible="False" Display="False" />
                <telerik:TreeListBoundColumn DataField="ID" UniqueName="ID" HeaderText="" Visible="False" Display="False" />
                <telerik:TreeListBoundColumn DataField="ParentID" UniqueName="ParentID" HeaderText="" Visible="False" Display="False" />
  2. Richard
    Richard avatar
    479 posts
    Member since:
    Nov 2011

    Posted 27 Apr 2012 Link to this post


    The reason that all columns are showing, despite setting the visible="false" property on some, is due to the fact that you have not added the AutoGenerateColumns="false" (true by default) to your RadTreeList markup:

    <telerik:RadTreeList ID="RadTreeList1" runat="server" OnNeedDataSource="RadTreeList1_NeedDataSource"
        AutoGenerateColumns="false" ParentDataKeyNames="ParentID" AllowMultiItemSelection="true"
        AllowPaging="true" PageSize="4" DataKeyNames="ID" AllowSorting="true">

    Also, I'd suggest reviewing this online demo: TreeList/Column Types which demonstrates how to create a hyperlink column that provides navigable URLs.

    <telerik:TreeListHyperLinkColumn DataTextFormatString="Bing '{0}'" DataNavigateUrlFields="ProductName"
        UniqueName="SearchProduct" DataNavigateUrlFormatString="{0}&go=&form=QBLH&qs=n&sk=&sc=8-9"
        HeaderText="HyperLink Column" DataTextField="ProductName" HeaderStyle-Width="140px">

    Hope this helps!
Back to Top