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

Insert/Update Command is not throwing

3 Answers 76 Views
Grid
This is a migrated thread and some comments may be shown as answers.
fer
Top achievements
Rank 1
fer asked on 04 Mar 2009, 01:25 PM
Hi, I have an issue.
I am using the radGrid, and when I try to insert or update a row with the insert/update command, nothing happens. The radGrid has both events assigned but they have never fired.

any idea?

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 04 Mar 2009, 03:10 PM
Hello Fer,

I'm not sure how to reproduce the depicted problem, following the description your provided. It would be helpful to elaborate a bit on your scenario.
In the meantime you can test the behavior of our RadGrid on the online demos.
RadGrid online demos

Kind regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
fer
Top achievements
Rank 1
answered on 04 Mar 2009, 03:24 PM
thanks for the quick answer. here is my code...

            <tr>    
                <td colspan="4">
                    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                        <AjaxSettings>
                            <telerik:AjaxSetting AjaxControlID="RadGrid">
                                <UpdatedControls>
                                    <telerik:AjaxUpdatedControl ControlID="RadGrid" LoadingPanelID="RadAjaxLoadingPanel1"/>
                                </UpdatedControls>
                            </telerik:AjaxSetting>
                            <telerik:AjaxSetting AjaxControlID="btnUpdate">
                                <UpdatedControls>
                                    <telerik:AjaxUpdatedControl ControlID="RadGrid" LoadingPanelID="RadAjaxLoadingPanel1"/>
                                    <telerik:AjaxUpdatedControl ControlID="btnUpdate" />
                                </UpdatedControls>
                            </telerik:AjaxSetting>
                            <telerik:AjaxSetting AjaxControlID="btnCancel">
                                <UpdatedControls>
                                    <telerik:AjaxUpdatedControl ControlID="RadGrid" LoadingPanelID="RadAjaxLoadingPanel1"/>
                                    <telerik:AjaxUpdatedControl ControlID="btnCancel" />
                                </UpdatedControls>
                            </telerik:AjaxSetting>
                            <telerik:AjaxSetting AjaxControlID="lnkInsert">
                                <UpdatedControls>
                                    <telerik:AjaxUpdatedControl ControlID="RadGrid" LoadingPanelID="RadAjaxLoadingPanel1"/>
                                    <telerik:AjaxUpdatedControl ControlID="lnkInsert" />
                                </UpdatedControls>
                            </telerik:AjaxSetting>
                        </AjaxSettings>
                    </telerik:RadAjaxManager>
                    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" Width="75px" Transparency="25">
                        <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' style="border:0;" />
                    </telerik:RadAjaxLoadingPanel>
                    <asp:LinkButton ID="lnkInsert" runat="server" CommandName="InitInsert" CausesValidation="false" Visible='<%# !RadGrid.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="../../DataEditing/Img/AddRecord.gif" /> Add new Product</asp:LinkButton>
                    <telerik:RadGrid ID="RadGrid" runat="server" AllowPaging="True" Width="950px" GridLines="None"
                        OnInsertCommand="RadGrid_InsertCommand"
                        OnItemInserted="RadGrid_ItemInserted"
                        OnItemDataBound="RadGrid_ItemDataBound" OnEditCommand="RadGrid_EditCommand"
                        OnNeedDataSource="RadGrid_NeedDataSource" OnUpdateCommand="RadGrid_UpdateCommand"
                        EnableAJAX="True" >
                        <HeaderContextMenu EnableTheming="True">
                            <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                        </HeaderContextMenu>
                        <MasterTableView DataKeyNames="Id" EditMode="EditForms">
                            <RowIndicatorColumn>
                            <HeaderStyle Width="20px"></HeaderStyle>
                            </RowIndicatorColumn>
                            <ExpandCollapseColumn>
                            <HeaderStyle Width="20px"></HeaderStyle>
                            </ExpandCollapseColumn>
                            <Columns>
                                <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" />
                                <telerik:GridBoundColumn UniqueName="Id" DataType="System.Int32" EditFormColumnIndex="0" Visible="false" DataField="Id" />
                                <telerik:GridBoundColumn UniqueName="ReferenciaArticulo" DataType="System.String" EditFormColumnIndex="0" HeaderText="Referencia Articulo" DataField="Articulo.Referencia" />
                                <telerik:GridBoundColumn UniqueName="Descripcion" DataType="System.String" EditFormColumnIndex="1" HeaderText="Descripcion" DataField="Articulo.Descripcion" />
                                <telerik:GridBoundColumn UniqueName="Cantidad" DataType="System.Double" EditFormColumnIndex="2" HeaderText="Cantidad" DataField="Cantidad" />
                                <telerik:GridBoundColumn UniqueName="CosteBruto" DataType="System.Double" EditFormColumnIndex="3" HeaderText="Coste Bruto" DataField="CosteBruto" />
                                <telerik:GridBoundColumn UniqueName="CosteTotalBruto" DataType="System.Double" EditFormColumnIndex="4" HeaderText="Coste Total Bruto" DataField="CosteTotalBruto" />                              
                            </Columns>
                            <EditFormSettings EditFormType="Template">
                                <EditColumn UniqueName="EditColumn"></EditColumn>
                                <FormTemplate>
                                    <table id="tblEdit" border="0" cellpadding="2">
                                        <tr><td><asp:HiddenField ID="txtId" Value='<%# Bind( "Id") %>' runat="server" /></td></tr>
                                        <tr>
                                            <td>Referencia Articulo: </td>
                                            <td><asp:TextBox ID="txtReferenciaArticulo" Text='<%# DataBinder.Eval(Container.DataItem, "Articulo.Referencia") %>' Width="100px" runat="server"></asp:TextBox></td>
                                            <td>Descripcion: </td>
                                            <td><asp:TextBox ID="txtDescripcion" Text='<%# DataBinder.Eval(Container.DataItem, "Articulo.Descripcion") %>'  Width="100px" runat="server"></asp:TextBox></td>
                                            <td>Cantidad: </td>
                                            <td><asp:TextBox ID="txtCantidad" Width="100px" Text='<%# Bind( "Cantidad") %>' runat="server"></asp:TextBox></td>
                                            <td>Coste Bruto: </td>
                                            <td><asp:TextBox ID="txtCosteBruto" Width="100px" Text='<%# Bind( "CosteBruto") %>' runat="server"></asp:TextBox></td>
                                            <td>Coste Total Bruto: </td>
                                            <td><asp:TextBox ID="txtCosteTotalBruto" ReadOnly="true" Width="100px" Text='<%# Bind( "CosteTotalBruto") %>' runat="server"></asp:TextBox></td>
                                        </tr>                                        
                                        <tr>
                                            <td>
                                                <asp:Button ID="btnUpdate" CausesValidation="false" CommandName="Update" Text="Update" runat="server" />
                                            </td>
                                            <td>
                                                <asp:Button ID="btnCancel" CausesValidation="false" CommandName="Cancel" Text="Cancel" runat="server" />
                                            </td>
                                        </tr>
                                    </table>
                                </FormTemplate>
                            </EditFormSettings>
                        </MasterTableView>
                        <ClientSettings>
                            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                        </ClientSettings>
                        <FilterMenu EnableTheming="True">
                            <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                        </FilterMenu>
                    </telerik:RadGrid>
                </td>
            </tr>
           
and the C# code is:

    protected void RadGrid_InsertCommand(object source, GridCommandEventArgs e)
    {
    }
    
     protected void RadGrid_EditCommand(object source, GridCommandEventArgs e)
    {
        this.RadGrid.MasterTableView.Items[e.Item.ItemIndex].Edit = true;
        this.RadGrid.MasterTableView.Rebind();   
    }



the problem is that insert and update command events never fired....I have read the demos, but I dont know why here is not working..
any ideas? thanks a lot!

0
Daniel
Telerik team
answered on 09 Mar 2009, 04:15 PM
Hello Fer,

I attached a modified version of your code to this post. Please download it at your side and let me know whether this helps.

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
fer
Top achievements
Rank 1
Answers by
Daniel
Telerik team
fer
Top achievements
Rank 1
Share this question
or