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

EditFormSettings > EditColumn does not fire the InsertCommand when pressing "Insert" in the edit form

3 Answers 155 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 03 Jul 2014, 07:25 AM
Creating all events and setting breakpoints, you will notice, when creating the first entry by clicking on "Insert" ("Einfügen") it will first call the ItemCommand-Event with e.CommandName = "PerformInsert", but then it will NOT enter the InsertCommand event. Just create the blank events to this example and set break points:

<asp:UpdatePanel ID="upPrices" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <telerik:RadGrid ID="trgPrices" runat="server" AllowPaging="true" Culture="de-DE"
            CssClass="RadGrid" AllowSorting="False" AutoGenerateColumns="false" ShowStatusBar="true" PageSize="20"
            OnNeedDataSource="trgPrices_NeedDataSource"
            OnItemCreated="trgPrices_ItemCreated"
            OnItemDataBound="trgPrices_ItemDataBound"
            OnItemCommand="trgPrices_ItemCommand"
            OnEditCommand="trgPrices_EditCommand"
            OnInsertCommand="trgPrices_InsertCommand"
            OnUpdateCommand="trgPrices_UpdateCommand"
            OnCancelCommand="trgPrices_CancelCommand"
            OnDeleteCommand="trgPrices_DeleteCommand">
            <MasterTableView DataKeyNames="ID" CommandItemDisplay="Top">
                <CommandItemSettings ShowAddNewRecordButton="true" ShowRefreshButton="false"></CommandItemSettings>
                <Columns>
                    <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditColumn" EditText="Bearbeiten">
                        <HeaderStyle Width="20px" />
                    </telerik:GridEditCommandColumn>
                    <telerik:GridNumericColumn UniqueName="HighestQuantity" DataField="HighestQuantity" DataType="System.Int32" HeaderText="Anzahl" DefaultInsertValue="999999" MaxLength="6" NumericType="Number" />
                    <telerik:GridNumericColumn UniqueName="UnitPrice" DataField="UnitPrice" DataType="System.Double" HeaderText="Stückpreis" DefaultInsertValue="0" DecimalDigits="2" NumericType="Currency" />
                    <telerik:GridButtonColumn ButtonType="ImageButton" UniqueName="DeleteColumn" CommandName="Delete" Text="Löschen">
                        <HeaderStyle Width="20px" />
                    </telerik:GridButtonColumn>
                </Columns>
                <EditFormSettings>
                    <EditColumn ButtonType="LinkButton" UniqueName="EditCommandColumn" InsertText="Einfügen" UpdateText="Speichern" CancelText="Abbrechen" />
                </EditFormSettings>
            </MasterTableView>
        </telerik:RadGrid>
    </ContentTemplate>
</asp:UpdatePanel>

What can I do?

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 03 Jul 2014, 08:30 AM
Hi Martin,

I tried the provided code and its working fine at my end. Make sure you have not disabled the ViewState anywhere. The ViewState should be enabled for these events to fire.

Thanks,
Princy
0
Martin
Top achievements
Rank 1
answered on 03 Jul 2014, 08:42 AM
[quote]Princy said:Hi Martin,

I tried the provided code and its working fine at my end. Make sure you have not disabled the ViewState anywhere. The ViewState should be enabled for these events to fire.

Thanks,
Princy[/quote]

This is weird, because the ViewState is enabled, as always. Also, when I click "Add new record" and then "Cancel" it will call trgPrices_CancelCommand successfully. But when I press Insert on the form it will not call trgPrices_InsertCommand. No matter what I do. I remember it worked when I built my own full edit template. Just this time I wanted to use the auto edit form for that, but it just getting not fired.

...
0
Martin
Top achievements
Rank 1
answered on 03 Jul 2014, 01:49 PM
For the report, I have even the same problem on the UpdateCommand. I finally fix this by working around and doing all the stuff in my ItemCommand event, however, I'm still confused.
Tags
Grid
Asked by
Martin
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Martin
Top achievements
Rank 1
Share this question
or