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

Edit/Update/Insert/Delete in the radgrid

3 Answers 145 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Newkid
Top achievements
Rank 1
Newkid asked on 10 Aug 2012, 03:29 AM
I found this sample but how do i remove edit/delete options from this sample?  Thanks!

http://mono.telerik.com/Grid/Examples/DataEditing/AllEditableColumns/DefaultCS.aspx 

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 10 Aug 2012, 03:57 AM
Hi,

Try removing the GridEditCommandColumn and the GridButtonColumn(UniqueName="DeleteColumn").Since you dont want to delete and update, remove the AllowAutomaticDeletes and AllowAutomaticUpdates as well.

Thanks,
Shinu.
0
Newkid
Top achievements
Rank 1
answered on 10 Aug 2012, 04:08 AM
Hi, tks for your quick response.  However, I removed "GridEditCommandColumn", when "add new record" is clicked, the insert and cancel buttons are gone.  Please advise.  thakns
0
Shinu
Top achievements
Rank 2
answered on 13 Aug 2012, 04:22 AM
Hi,

Try the following code to show insert and cancel buttons in insert mode and hide EditColumn in edit mode.
C#:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
 {
    if (e.Item is GridDataInsertItem && e.Item.OwnerTableView.IsItemInserted)
    {
        RadGrid1.MasterTableView.GetColumn("EditcolumnUniqueName").Visible = true;
        foreach (GridDataItem dataItem in RadGrid1.MasterTableView.Items)
        {
            ((LinkButton)dataItem["EditcolumnUniqueName"].Controls[0]).Visible = false;
        }
     }
     else
      {
         RadGrid1.MasterTableView.GetColumn("EditcolumnUniqueName").Visible = false;
      }
}

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