Grid Detail Table CommandItem

2 posts, 0 answers
  1. Matthew
    Matthew avatar
    3 posts
    Member since:
    Sep 2014

    Posted 18 Nov 2015 Link to this post

    Hi all,

    How would I go about showing/hiding the CommandItem for a detail table from an external button in the code behind.Our webapp has a set of "new", "edit" & "save" buttons created in a masterpage which are enable/disabled based on the users access rights. I want to be able to allow a user to create a new record within a radgrid at both the master table and detail table level. I can enable the CommandItem for the master table but i cant do it for the detail tables. I've tried looping through the NestedTableView items but on a rebind the grid doesn't change


    Thanks Matt



  2. Eyup
    Eyup avatar
    3940 posts

    Posted 23 Nov 2015 Link to this post

    Hi Matt,

    Generally, you can traverse the GridTableViews to achieve this requirement:

    Alternatively, you can enable all command items:
    <telerik:GridTableView ...
        CommandItemDisplay="Top" Name="OrderDetails">

    and alter their visibility depending on some global variable/condition:
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        if (e.Item is GridCommandItem && e.Item.OwnerTableView.Name == "OrderDetails")
            GridCommandItem commandItem = (GridCommandItem)e.Item;
            commandItem.Visible = false;
            // commandItem.Display = false;
            // commandItem.Style["display"] = "false";

    Hope this helps.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top