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

Hide Command Row

1 Answer 486 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Giorgos
Top achievements
Rank 1
Giorgos asked on 26 Apr 2013, 03:36 PM
Hi all,

I have the following simple grid.

<telerik:RadGrid ID="grdMyGrid" runat="server" 
   AutoGenerateColumns="false"
   OnNeedDataSource="grdNewEpidomaTheshs_NeedDataSource">
   <MasterTableView EditMode="InPlace"  CommandItemDisplay="Top" 
      CommandItemSettings-AddNewRecordText="Add new record">
       
      <
NoRecordsTemplate>No records available</NoRecordsTemplate>
      <Columns> ... some columns ...</Columns>
   </MasterTableView>
</telerik:RadGrid>

All I want to do is hide the row containing the "add new record" when another row is in edit mode, i.e. when the edit button has been 
clicked

1 Answer, 1 is accepted

Sort by
0
Giorgos
Top achievements
Rank 1
answered on 26 Apr 2013, 04:09 PM
The solution is rather simple:

protected void grdMyGrid_ItemCommand(object sender, GridCommandEventArgs e)
{
    if (e.CommandName == RadGrid.EditCommandName)
    {
        // hide command row when some grid row is being edited
        grdMyGrid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;
    }
    else if ((e.CommandName == RadGrid.UpdateCommandName) || (e.CommandName == RadGrid.CancelCommandName))
    {
        // restore command row visibility when user is done editing
        grdMyGrid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
    }
}
Tags
Grid
Asked by
Giorgos
Top achievements
Rank 1
Answers by
Giorgos
Top achievements
Rank 1
Share this question
or