Not to show Add new record

7 posts, 0 answers
  1. pradeep k
    pradeep k avatar
    42 posts
    Member since:
    Nov 2009

    Posted 16 Nov 2009 Link to this post

    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.
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 16 Nov 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. pradeep k
    pradeep k avatar
    42 posts
    Member since:
    Nov 2009

    Posted 16 Nov 2009 Link to this post

    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.
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 16 Nov 2009 Link to this post

    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.
  6. pradeep k
    pradeep k avatar
    42 posts
    Member since:
    Nov 2009

    Posted 16 Nov 2009 Link to this post

    Thank you.
  7. Espen Fosshaug
    Espen Fosshaug avatar
    18 posts
    Member since:
    Sep 2009

    Posted 20 Jan 2010 Link to this post

    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.
  8. Laurie
    Laurie avatar
    141 posts
    Member since:
    Feb 2007

    Posted 16 Feb 2010 Link to this post

    I second Espen's request! Also, I'd love to be able to get rid of the vertical bar.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017