Hide Command Row

2 posts, 0 answers
  1. Giorgos
    Giorgos avatar
    18 posts
    Member since:
    Apr 2013

    Posted 26 Apr 2013 Link to this post

    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
  2. Giorgos
    Giorgos avatar
    18 posts
    Member since:
    Apr 2013

    Posted 26 Apr 2013 Link to this post

    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;
        }
    }
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top