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

Not to show Add new record

6 Answers 140 Views
Grid
This is a migrated thread and some comments may be shown as answers.
pradeep k
Top achievements
Rank 1
pradeep k asked on 16 Nov 2009, 03:29 PM
Hi All,

In RadGrid i am using exporting to excel, word etc, i dont want to show Add new record command in the CommandItemSettings.

Please help me regarding this.

6 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 16 Nov 2009, 03:59 PM
Hi,

You can define your own template similar to this demo.

Kind regards,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
pradeep k
Top achievements
Rank 1
answered on 17 Nov 2009, 04:45 AM
Thanks for the reply,

Actually i want to show excel, cvs,word export in grid, so i have written belo code

<CommandItemSettings  ShowExportToWordButton="true" ShowExportToExcelButton="true"
                                        ShowExportToCsvButton="true" ShowExportToPdfButton="false" />

my problem is, if i write above code it is showing add new record also on top, but i dont want to show add new record, i need only excel,cvs,word only.

please help me regarding this.
0
Princy
Top achievements
Rank 2
answered on 17 Nov 2009, 05:20 AM
Hello Pradeep,

Inorder to hide the AddNewRecord and Refresh buttons from the CommandItem, you can try the following code:
c#:
 protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) 
    { 
        GridCommandItem cmdItem = (GridCommandItem)RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)[0]; 
        ((LinkButton)cmdItem.FindControl("InitInsertButton")).Visible = false
        ((Button)cmdItem.FindControl("AddNewRecordButton")).Visible = false
        ((LinkButton)cmdItem.FindControl("RebindGridButton")).Visible = false
        ((Button)cmdItem.FindControl("RefreshButton")).Visible = false
    } 

Thanks
Princy.
0
pradeep k
Top achievements
Rank 1
answered on 17 Nov 2009, 05:29 AM
Thank you.
0
Espen Fosshaug
Top achievements
Rank 1
answered on 20 Jan 2010, 02:08 PM
Hi Telerik!

This solution is working, but please, please add a Show Add New Record setting to the grid. In my scenario I never want to add records, but always export and refresh. I have to add this snippet to all grids I am using.
0
Laurie
Top achievements
Rank 2
answered on 16 Feb 2010, 05:06 PM
I second Espen's request! Also, I'd love to be able to get rid of the vertical bar.
Tags
Grid
Asked by
pradeep k
Top achievements
Rank 1
Answers by
Vlad
Telerik team
pradeep k
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Espen Fosshaug
Top achievements
Rank 1
Laurie
Top achievements
Rank 2
Share this question
or