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

How to : Remove Addnew Command Item

5 Answers 57 Views
Grid
This is a migrated thread and some comments may be shown as answers.
VIRUX
Top achievements
Rank 1
VIRUX asked on 05 Jan 2010, 09:23 AM


Hi,,

http://i50.tinypic.com/2meoc45.png

Even spent many hours , I can't find a way to remove ' AddNew' link button in radgrid.
Why 'Show csv/excel/pdf' properties available but add new is the permanent one ??

Please help..
Thanks n rgds,

5 Answers, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 05 Jan 2010, 09:44 AM
Hello Zay,

I already answered to your ticket. Please avoid posting multiple tickets/threads concerning the same question in order to keep the communication in one place and keep track of its history more easily

"At the present moment you can hide the aforementioned button manually in code-behind. We will add the relevant properties in a future version of RadControls for ASP.NET AJAX."
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is GridCommandItem)
        e.Item.FindControl("AddNewRecordButton").Parent.Visible = false;
}

Regards,
Daniel
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
Accepted
Shinu
Top achievements
Rank 1
answered on 05 Jan 2010, 09:47 AM
Hello,

You can try the following code snippet in order to hide the "Add New Record" button in grid.

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

-Shinu.
0
VIRUX
Top achievements
Rank 1
answered on 06 Jan 2010, 01:21 AM
Sorry about multiple post Admin ...
I think that one is not successfully posted. Please delete.
Thank you so much for your quick reply.
Regards,
0
CulminIT
Top achievements
Rank 2
answered on 03 Mar 2010, 08:48 AM
Hi

I tried your solution and many others, but none of them seem to remove the "add new record" button or the text.

Please advice as this is supposed to be a read-only grid with a refresh button only.

Thank you
0
Daniel
Telerik team
answered on 03 Mar 2010, 09:28 AM
Hello,

Please download the attached demo and let us know if it works property on your end.

Best regards,
Daniel
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
VIRUX
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Shinu
Top achievements
Rank 1
VIRUX
Top achievements
Rank 1
CulminIT
Top achievements
Rank 2
Share this question
or