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

[Solved] Allow only Insert/Delete actions in RADGrid with EditMode="InPlace"

1 Answer 243 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 12 Jan 2010, 06:02 AM
Hi, I'm wondering if there is a way to allow only Insert and Delete actions in a RADGrid when using EditMode="InPlace".  I have a GridEditCommandColumn in the grid, but I really only want users to be able to Insert/Delete records in this grid, not add.  Any ideas?

Thanks in advance,
Andrew

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 12 Jan 2010, 06:45 AM
Hello Andrew,

When using Inplace editmode, you need to have the EditCommandColumn displayed in order to show the insert and cancel buttons. You can try the following code snippet in order to hide the Edit links and show Insert/Cancel buttons only.

CS:
 
    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
        } 
    } 

-Shinu.
Tags
Grid
Asked by
Andrew
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or