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

Add New Record, but no Edit Column

1 Answer 35 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
AName asked on 24 Jul 2013, 02:48 PM
Hi there,
I am new to RadGrid so please excuse. 
I need to have users Add New Records or Remove records only.  This is inline editing mode written in VB.

The issue I face is on click of the Add New Record from the CommandItem menu creates a new row, but does not allow a user to Submit or Cancel.  If I enable the Edit Column, I see the red X for cancel and green Checkmark for submit.
However if I add the EditColumn to the grid, and click Add New Record these options are displayed.
How can I provide Add New without allowing enabling Edit of existing rows?

Thank you

1 Answer, 1 is accepted

Sort by
Top achievements
Rank 1
answered on 25 Jul 2013, 04:16 AM
Hi ,

When using Inplace editmode, you need to have the EditCommandColumn displayed in order to show the insert and cancel buttons. If you want to hide the EditCommandColumn but still display the insert and cancel buttons, then you can either use EditForms OR use the following code to conditionally hide the EditCommandColumn.

<telerik:RadGrid ID="RadGrid1" runat="server"   onitemdatabound="RadGrid1_ItemDataBound">
    <MasterTableView CommandItemDisplay="Top" EditMode="InPlace" InsertItemPageIndexAction="ShowItemOnCurrentPage">
           <telerik:GridEditCommandColumn UniqueName="EditCommandColumnUniqueName">
               . . . . . . . . . . . .

Protected Sub RadGrid1_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs)
    If TypeOf e.Item Is GridDataInsertItem AndAlso e.Item.OwnerTableView.IsItemInserted Then
        RadGrid1.MasterTableView.GetColumn("EditCommandColumnUniqueName").Visible = True
        For Each dataItem As GridDataItem In RadGrid1.MasterTableView.Items
            DirectCast(dataItem("EditCommandColumnUniqueName").Controls(0), LinkButton).Visible = False
        RadGrid1.MasterTableView.GetColumn("EditCommandColumnUniqueName").Visible = False
    End If
End Sub

Asked by
Top achievements
Rank 1
Answers by
Top achievements
Rank 1
Share this question