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

hide command buttons/links issue

0 Answers 42 Views
Grid
This is a migrated thread and some comments may be shown as answers.
El
Top achievements
Rank 1
El asked on 19 Mar 2010, 11:27 AM
I managed it to hides Add New Record button but only the one at the top. The other one at the bottom remains visible :(
if (e.Item is GridCommandItem) 
                    { 
                        GridCommandItem cmdItem = (GridCommandItem)RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)[0]; 
                        ((LinkButton)cmdItem.FindControl("InitInsertButton")).Visible = false
                    } 

Also how do i hide the delete button? I tried the next but it didn't work properly.

if (e.Item is GridDataItem) 
                    { 
                        GridDataItem item = (GridDataItem)e.Item; 
                        LinkButton editButton = (LinkButton)item.FindControl("EditButton"); 
                        editButton.Visible = false
                        //LinkButton deleteButton = (LinkButton)item.FindControl("DeleteButton"); 
                        //deleteButton.Visible = false; 
                    } 

the Edit button gets hidden but the delete throws an exception "Object reference not set to an instance of an object".


No answers yet. Maybe you can help?

Tags
Grid
Asked by
El
Top achievements
Rank 1
Share this question
or