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

Insert only in grid

4 Answers 102 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 2
Scott asked on 16 Sep 2010, 06:04 PM
Hi All. Sorry if this has been answered previously but i couldn't find any related posts.

I am trying to design a grid with the "Add a New Record" option in the header and footer (CommandItemDisplay="TopAndBottom")  for an InPlace insert. It works great if i put a command column in the grid. However I would like to only show the insert and cancel commands in the row that is to be inserted. The MasterTableView has the "AllowAutomaticInserts="true" property set, none of the other automatic properties are set. I do not want an edit option on all the other existing rows in the grid. Can someone point me in the right direction to accomplish this?

Thanks for your help.
Scott

4 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 17 Sep 2010, 05:29 AM
Hello Scott,

Showing GridCommandItem (CommandItemDisplay="TopAndBottom") will only show the interface to open RadGrid insert form. The items that already exists in the grid will no have editing option.

All the best,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Shinu
Top achievements
Rank 2
answered on 17 Sep 2010, 07:17 AM
Hello Scott,


If you want to show the insert options and want to remove the edit LinkButtons, then the following code will be of help.

Code:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
      if (e.Item is GridHeaderItem) 
        RadGrid1.MasterTableView.GetColumn("EditColumn").Display = RadGrid1.MasterTableView.IsItemInserted; 
    if (e.Item is GridEditableItem && !e.Item.IsInEditMode) 
        (e.Item as GridEditableItem)["EditColumn"].Controls[0].Visible = false;  
 
}

ASPX:
<Columns>
    <telerik:GridEditCommandColumn UniqueName="EditColumn">
    </telerik:GridEditCommandColumn>



-Shinu.
0
Scott
Top achievements
Rank 2
answered on 17 Sep 2010, 02:13 PM
Thank you both for your replies.
@Nikolay, you are correct, the insert form will show when clicking on the Add new record button. However I was hoping to use the Inline edit (insert) without having an edit link or button on each of the existing lines. I have attached an image of how I would like the grid to function.

@Shinu, I have tried your suggestion and I still am getting an edit option. I tried moving the code to the ItemCommand event as well and it sill doesn't work as desired.

Thanks again for your help
Scott
0
Accepted
Pavlina
Telerik team
answered on 23 Sep 2010, 10:55 AM
Hi Scott,

To achieve your goal you can customize the command item by using the template of a GridTableView.CommandItemTemplate. Please refer to the help article below for addiitonal information.

Sincerely yours,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Scott
Top achievements
Rank 2
Answers by
Nikolay Rusev
Telerik team
Shinu
Top achievements
Rank 2
Scott
Top achievements
Rank 2
Pavlina
Telerik team
Share this question
or