Hide the DELETE button

This is a code sample for how to hide the DELETE button in a Telerik ASP.NET RadGrid

Front side code

<telerik:GridButtonColumn ConfirmText="Delete this voucher?" ConfirmDialogType="RadWindow" HeaderText="DELETE"
    ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" ConfirmDialogHeight="100px"
    ConfirmDialogWidth="220px" UniqueName="delete"  />

 

Back side code

Private Sub RadGrid1_ItemDataBound(sender As Object, e As GridItemEventArgs) Handles RadGrid1.ItemDataBound
    If TypeOf e.Item Is Telerik.Web.UI.GridDataItem Then
 
        'access to the form
        Dim oItem As GridDataItem = DirectCast(e.Item, GridDataItem)
        'access to the data
        Dim oRow As DataRowView = CType(e.Item.DataItem, DataRowView)
        'get the batch number from the data
        Dim strBatchNumber As String = oRow("bachnumb")
 
        'get a reference to the delete button
        Dim btnDelete As ImageButton = CType(oItem("delete").Controls(0), ImageButton)
 
        'conditionally hide it
        If strBatchNumber <> "OPEN" Then
            btnDelete.Visible = False
        End If
 
    End If
End Sub

 

 


RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences