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

Disable 'add new record' button

1 Answer 24 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ryann
Top achievements
Rank 1
Ryann asked on 04 Sep 2013, 01:00 PM
Hi, 

 I am new to radcontrols...
 How can I disable  'addnewrecord'  button when the grid is in edit mode.

Thanks, 
Ryann

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 1
answered on 04 Sep 2013, 01:07 PM
Hi Ryann,

Please try the following code snippet.

C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
    {
        if (RadGrid1.EditItems.Count > 0)
        {
            GridCommandItem cmditm = (GridCommandItem)RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)[0];
            Button btn1 = (Button)cmditm.FindControl("AddNewRecordButton");
            btn1.Enabled = false;
            LinkButton lnkbtn1 = (LinkButton)cmditm.FindControl("InitInsertButton");
            lnkbtn1.Enabled = false;
        }
    }

Thanks,
Princy
Tags
Grid
Asked by
Ryann
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or