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

Delete on only certain rows

1 Answer 73 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 07 Dec 2010, 10:07 PM

Hi, I have a question in regards to selective delete.  I have a grid with delete option defined as below

 

 

 

 

<telerik:GridButtonColumn ConfirmText="Delete this record?" ConfirmDialogType="RadWindow"

 

 

ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"

 

 

UniqueName="DeleteAlignment">

Now, I want to selectivele remove the delete option on some of the rows.  Is there a way to do that?  So I wan say delete option on the first 5 rows only... or something like that

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 08 Dec 2010, 06:19 AM
Hello John,

You can try the following code snippet to achieve your requirement.

C#:
if (e.Item is  GridDataItem)
      {
          GridDataItem item = (GridDataItem)e.Item;
          ImageButton btnDelete = (ImageButton)item["DeleteAlignment"].Controls[0];
          if ()// your condition
          {
              btnDelete.Visible = false;
          }
      }

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