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

[Solved] RadGrid Conditional Edit button

2 Answers 504 Views
Grid
This is a migrated thread and some comments may be shown as answers.
RB
Top achievements
Rank 1
RB asked on 28 Mar 2014, 08:39 PM
I have a Radgrid with Inline Edit Mode. There are 8 columns in it, and if value of Product column is "XVZ", the edit button should not be visible. How can I achieve this?

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 31 Mar 2014, 03:12 AM
Hi,

Please try the following code snippet to hide Edit button for a row.

ASPX:
<telerik:GridEditCommandColumn UniqueName="GridEditCommandColumn">
</telerik:GridEditCommandColumn>

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem item = (GridDataItem)e.Item;
        if (item["Product"].Text == "XVZ")
        {
            LinkButton editButton = (LinkButton)item["GridEditCommandColumn"].Controls[0];
            editButton.Visible = false;
        }
    }
}

Thanks,
Princy
0
RB
Top achievements
Rank 1
answered on 31 Mar 2014, 10:02 PM
Thanks. Worked.
Tags
Grid
Asked by
RB
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
RB
Top achievements
Rank 1
Share this question
or