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

Grid Detail Table CommandItem

1 Answer 169 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matthew
Top achievements
Rank 1
Matthew asked on 18 Nov 2015, 03:03 PM

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

 

 

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 23 Nov 2015, 11:28 AM
Hi Matt,

Generally, you can traverse the GridTableViews to achieve this requirement:
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/hierarchical-grid-types-and-load-modes/how-to/hiding-the-expand-collapse-images-when-no-records

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.

Regards,
Eyup
Telerik
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
Tags
Grid
Asked by
Matthew
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or