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

[Solved] InsertCommand not fired

1 Answer 133 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aurore
Top achievements
Rank 1
Aurore asked on 23 Sep 2009, 09:12 AM
Hello,

I have a RadGrid, with
<tlk:RadGrid ID="oGrid" runat="server" AutoGenerateColumns="False" Height="470px"  
        AllowPaging="True" PageSize="100" 
        OnNeedDataSource="oGrid_NeedDataSource" AllowSorting="True"  
        OnInsertCommand="oGrid_InsertCommand" OnUpdateCommand="oGrid_UpdateCommand" OnDeleteCommand="oGrid_DeleteCommand" 
        OnItemDataBound="oGrid_ItemDataBound" OnCancelCommand="oGrid_CancelCommand" 
        GridLines="None" EnableViewState="false">
<MasterTableView CommandItemDisplay="Top" EditMode="InPlace" DataKeyNames="IDUser"
            InsertItemPageIndexAction="ShowItemOnCurrentPage" EnableNoRecordsTemplate="true">
            <CommandItemSettings AddNewRecordImageUrl="~/Images/add.png" RefreshImageUrl="~/Images/blank.gif" RefreshText="" />
            <NoRecordsTemplate>
                <div>&nbsp;</div>
            </NoRecordsTemplate>
             <Columns>
                <tlk:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn"
                    CancelImageUrl="~/Images/failed.png" InsertImageUrl="~/Images/ok.png"
                    UpdateImageUrl="~/Images/ok.png" Resizable="false">
                    <ItemStyle HorizontalAlign="Center" CssClass="CursorHand" />
                </tlk:GridEditCommandColumn>

When a row pass in edit mode for "update" all works fine. Click on update fires  "oGrid_UpdateCommand", click on cancel fires"oGrid_CancelCommand".

When I use "add a new user", a new row appears, but no more insertCommand and CancelCommand fire ? (the postback is perfomed, I stop in Page_load function but the "ogrid_InsertCommand" is not called.

The trys I have made :
    - comment ajax, the same problem occurs
    - try to set AllowAutomaticDeletes/Inserts/Updates to false : the problem still persists.
   - try to trace Params["__eventargstarget"], it is empty when insert is fired.

An idea ?

Thanks
Aurore

1 Answer, 1 is accepted

Sort by
0
Aurore
Top achievements
Rank 1
answered on 24 Sep 2009, 09:14 AM
Hello,

I've found why it doesn't work : it's because of "enableviewstate=false".

If I remove this, all is ok.

I should wake up, all is ok, I don't know why I have put "enableviewstate=false".

I use
protected override object LoadPageStateFromPersistenceMedium() 
    { 
        return Session["_viewState"]; 
    } 
    protected override void SavePageStateToPersistenceMedium(object viewState) 
    { 
        Session["_viewState"] = viewState; 
    } 

All is ok !

Thanks
Aurore
Tags
Grid
Asked by
Aurore
Top achievements
Rank 1
Answers by
Aurore
Top achievements
Rank 1
Share this question
or