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

CommandItemDisplay

7 Answers 204 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mww
Top achievements
Rank 1
mww asked on 17 Dec 2010, 04:46 PM
How can the command toolbar be set to show only the refresh button ?  I dont need the insert option.

7 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 17 Dec 2010, 05:36 PM
Hello,

The easiest way would be to hide the AddNewRecord button through the CommandItemSettings property:
<CommandItemSettings ShowAddNewRecordButton="false" />

Regards,
Daniel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
mww
Top achievements
Rank 1
answered on 17 Dec 2010, 06:26 PM
where exactly in the grid does this go ?  Ive scrolled through the properties but cant find it
0
mww
Top achievements
Rank 1
answered on 17 Dec 2010, 06:31 PM
Ive tried putting it in various places in the grid but I get this error


Parser Error Message: Type 'Telerik.Web.UI.RadGrid' does not have a public property named 'CommandItemSettings'.
0
Princy
Top achievements
Rank 2
answered on 20 Dec 2010, 10:42 AM
Hello,

You could place the CommandItemSettings inside MasterTableView tag like below.

ASPX:
<MasterTableView Name="Master" runat="server" CommandItemDisplay="Top"
    CommandItemSettings-ShowAddNewRecordButton="false">

Thanks,
Princy.
0
mww
Top achievements
Rank 1
answered on 20 Dec 2010, 11:14 AM
Ive tried that but it doesnt work, the add button is still there.  I get an error in the ide

Attribute CommandItemSettings-ShowAddNewRecordButton is not a valid attribute of element MasterTableView
0
mww
Top achievements
Rank 1
answered on 20 Dec 2010, 11:18 AM
Ive also tried adding this

<CommandItemSettings ShowAddNewRecordButton="false" ShowExportToExcelButton="true" ShowExportToPdfButton="true" />

but I get an error

ShowAddNewRecordButton is not a valid attribute of CommandItemSettings
0
Princy
Top achievements
Rank 2
answered on 21 Dec 2010, 09:50 AM
Hello,

I guess you are using older version of Telerik control. The property ShowAddNewRecordButton is available from the version  Q1 2010 BETA (version 2010.1.216). You can achieve the same by accessing the control and then setting the visibility to false. Here is the sample code.

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

Thanks,
Princy.
Tags
Grid
Asked by
mww
Top achievements
Rank 1
Answers by
Daniel
Telerik team
mww
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or