How to hide the insert button on the top-left corner?

5 posts, 1 answers
  1. wg
    wg avatar
    30 posts
    Member since:
    Jul 2006

    Posted 06 Apr 2013 Link to this post

    What I want is to show/hide the Insert button by permission of user. 

    Can I do that?

    Thanks,
    Bill
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 08 Apr 2013 Link to this post

    Hi,

    Try the following code.
    C#:
    protected void RadTreeList1_ItemDataBound(object sender, Telerik.Web.UI.TreeListItemDataBoundEventArgs e)
    {
        if (e.Item.ItemType == TreeListItemType.AlternatingItem || e.Item.ItemType == TreeListItemType.Item)
        {
            TreeListDataItem item = e.Item as TreeListDataItem;
            if (item["username"].Text == "name")
            {
                (item["EditCommandColumn"].FindControl("InsertButton_EditCommandColumn") as LinkButton).Visible = false;
            }
         }
    }

    Thanks,
    Shinu
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. wg
    wg avatar
    30 posts
    Member since:
    Jul 2006

    Posted 08 Apr 2013 Link to this post

    Hi Shinu,

    Many thanks for your reply, and I made little change.

    if (e.Item.ItemType == TreeListItemType.AlternatingItem || e.Item.ItemType == TreeListItemType.Item)
    {
        TreeListDataItem item = e.Item as TreeListDataItem;
     
        var linkButton = item["EditCommandColumn"].FindControl("InsertButton_EditCommandColumn");
        linkButton.Visible = false;
        //(item["EditCommandColumn"].FindControl("InsertButton_EditCommandColumn") as LinkButton).Visible = false;
    }


    But it looks like it only applied to dataitem, not the left-top corner(header row) button.

    Please take a look at the attachment. 

    Thank you  very much.

    Bill


  5. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 08 Apr 2013 Link to this post

    Hi,

    Try overriding the default CSS as shown below.
    CSS:
    .RadTreeList .rtlAdd
     {
        display:none !important;
     }

    Thanks,
    Shinu
  6. wg
    wg avatar
    30 posts
    Member since:
    Jul 2006

    Posted 12 Apr 2013 Link to this post

    Hi Shinu,

    Thank you very much again. This is the solution I will use, you really helped me a lot.

    Looks like Telerik doesn't like TreeList more than Grid. : )

    Bill
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017