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

Radgrid with Insert and no Update.

4 Answers 168 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Swapna M
Top achievements
Rank 1
Swapna M asked on 13 Apr 2010, 03:30 PM
Hi,
    I have a Radgrid where I have set 

AllowAutomaticUpdates

 

="false" and 

 

AllowAutomaticInserts

 

="True" and

<

 

telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">

 

 

<ItemStyle CssClass="MyImageButton" />

 

 

</telerik:GridEditCommandColumn>

 

as first column of the Grid.

    Even though i have set AllowAutomaticUpdates="false",  I am getting GridEditColumn with Edit Icon.
How to get rid of Edit Icon and have only Insert Operation.


Thanks.

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 14 Apr 2010, 05:35 AM

Hello Swapna,

When we set AllowAutomaticUpdates to True, the DataSource is updated automatically when binding the grid to a declarative data source using the DataSourceID property of the grid. This doesn't mean setting Edit button's visibility in grid.

If you want to hide the EditColumn, then just remove GridEditCommandColumn from the column collection.

-Shinu.

0
Swapna M
Top achievements
Rank 1
answered on 14 Apr 2010, 05:59 AM
Hi Shinu,
        Thanks for your quick reply.

        If I remove the EditCommandColumn, ok and cancel buttons are not displayed for Insert Operation.
Please refer the attached screenshots.
0
Accepted
Shinu
Top achievements
Rank 2
answered on 14 Apr 2010, 10:44 AM

Hello Swapna,

Try the following approach in order to show buttons for insert form only and not for edit form.

C#:

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

Regards,

Shinu.

0
Swapna M
Top achievements
Rank 1
answered on 14 Apr 2010, 11:38 AM
Thanks Shinu. It worked. :)
Tags
Grid
Asked by
Swapna M
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Swapna M
Top achievements
Rank 1
Share this question
or