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

Hiding the edit button

1 Answer 37 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 19 Nov 2012, 03:23 PM
Hi,
I want to hide/disable the edit button dependent on what is in the row. Hypothetically speaking if there was one column (showing complete and uncomplete), and the edit button column, i only want the edit button to appear or be enabled on rows that were uncomplete.
Many Thanks
Ryan 

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 20 Nov 2012, 03:28 AM
Hi Ryan,

Please check the following code snippet.

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem item = (GridDataItem)e.Item;
        if (//your condition)
        {
            LinkButton editcommand = (LinkButton)item["EditCommandColumn"].Controls[0]; //Accessing EditCommandColumn
            editcommand.Visible = false;
            LinkButton autoEdit = (LinkButton)item["AutoGeneratedEditColumn"].Controls[0]; //Accessing AutoGeneratedEditColumn
            autoEdit.Visible = false;
        }
    }
}

Thanks,
Shinu.
Tags
Grid
Asked by
Ryan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or