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

hide delete button for some rows

1 Answer 58 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Erin
Top achievements
Rank 1
Erin asked on 03 Dec 2013, 11:30 AM
Hi.
i have a grid in that i have a gridbuttoncolumn for delete. I want to hide it for some rows only.how to do it?

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 03 Dec 2013, 11:43 AM
Hi Erin,

Please try the following code snippet.

ASPX:
<telerik:GridButtonColumn Text="Delete" CommandName="Delete" UniqueName="DeleteButton">
</telerik:GridButtonColumn>

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
  if (e.Item is GridDataItem)
  {
    GridDataItem item = (GridDataItem)e.Item;
    LinkButton dellnk = (LinkButton)item["DeleteButton"].Controls[0];
    if (Your condition)
    {               
        dellnk.Visible = false;// Hide the delete button
    }
  }
}

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