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

Hide addnew button

1 Answer 49 Views
Grid
This is a migrated thread and some comments may be shown as answers.
lakmal
Top achievements
Rank 2
lakmal asked on 20 Feb 2010, 05:51 PM
Hi,

How can i hide and show addnew Button in run time?

lakmal

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 22 Feb 2010, 04:17 AM
Hello Lakmal,

The code snippet shown below will help you in showing/hiding the "Add New Record" button in CommandItem.

C#:
 
    protected void Button1_Click(object sender, EventArgs e) 
    { 
        GridCommandItem cmdItem = (GridCommandItem)RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)[0]; 
        // cmdItem.FindControl("AddNewRecordButton").Parent.Visible = false; // Hide the buttons 
        cmdItem.FindControl("AddNewRecordButton").Parent.Visible = !cmdItem.FindControl("AddNewRecordButton").Parent.Visible; 
    } 

-Shinu.
Tags
Grid
Asked by
lakmal
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Share this question
or