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

Hide add-new record button

1 Answer 327 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 05 Feb 2013, 09:51 AM
Hi

     How can I hide the add new record button if there are more than 10 row in radgrid. Please help

thanks
RT

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 05 Feb 2013, 10:00 AM
Hi,

Please try the following code snippet to hide the 'AddNewRecord' button.

C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    if (RadGrid1.MasterTableView.Items.Count == 10)
    {
        GridCommandItem cmdItem = (GridCommandItem)RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)[0];
        ((LinkButton)cmdItem.FindControl("InitInsertButton")).Visible = false;
        ((Button)cmdItem.FindControl("AddNewRecordButton")).Visible = false;
    }
}

Thanks,
Shinu.
Tags
Grid
Asked by
Ryan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or