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

UpdateMethod not fired

6 Answers 222 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Fabio Laserra
Top achievements
Rank 1
Fabio Laserra asked on 10 Feb 2010, 04:38 PM
Hello
I'm using for first time RadGrid with ObjectDataSource. I have read docs and seen samples but nothing that can help my issue. While SelectMethod is fired, UpdateMethod  is never fired. Also Updating event of ObjectDataSource and UpdateCommand of RagGrid are not fired. Simply it does not works. The same behaviour for InsertMethod.

Does anyone can suggest me a solution?
This is the code I used:

<asp:ObjectDataSource ID="objDataSourceGridSAL" runat="server" TypeName="xxx.ElencoTipologieInformazioni.Lavori_SAL_Controller"
                                        DataObjectTypeName="xxx.ElencoTipologieInformazioni.Lavori_SAL_Info"
                                        SelectMethod="FB_GetLavoriSAL" UpdateMethod="FB_UpdateLavoriSAL" OldValuesParameterFormatString="original_{0}">
                                        <SelectParameters>
                                            <asp:Parameter Name="pintCodOpera" Type="Int32" />
                                            <asp:Parameter Name="pintCodLavoro" Type="Int32" />
                                        </SelectParameters>
                                        <UpdateParameters>
                                            <asp:Parameter Name="CodOpera" Type="Int32" />
                                            <asp:Parameter Name="CodLavoro" Type="Int32" />
                                            <asp:Parameter Name="Codice" Type="Int32" />
                                            <asp:Parameter Name="Percentuale" Type="Int32" />
                                            <asp:Parameter Name="DataRilevamento" Type="DateTime" />
                                            <asp:Parameter Name="Note" Type="String"  />
                                            <asp:Parameter Name="NoteTestoSemplice" Type="String" />
                                        </UpdateParameters>
                                    </asp:ObjectDataSource>
                                    <telerik:RadGrid runat="server" ID="RadGridSchedaLavori_SAL" DataSourceID="objDataSourceGridSAL"
                                        ShowFooter="True" AllowPaging="True" AllowFilteringByColumn="True"
                                        AutoGenerateColumns="False" AutoGenerateEditColumn="false" Skin="Office2007"
                                        GridLines="None" ShowGroupPanel="true" >
                                        <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                                        <MasterTableView  DataSourceID="objDataSourceGridSAL" TableLayout="Fixed" ShowGroupFooter="true" GroupsDefaultExpanded="true"
                                            AllowSorting="true" CommandItemDisplay="Bottom" OverrideDataSourceControlSorting="true"
                                            DataKeyNames="CodOpera,CodLavoro,Codice" PageSize="3" AllowAutomaticUpdates="true">
                                            <NoRecordsTemplate>Nessun record presente!</NoRecordsTemplate>
                                            <Columns>
                                                <telerik:GridBoundColumn DataField="CodOpera" Visible="false" DataType="System.Int32"
                                                    UniqueName="CodOpera" ReadOnly="true">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="CodLavoro" Visible="false" DataType="System.Int32"
                                                    UniqueName="CodLavoro" ReadOnly="true">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="Codice" Visible="false" DataType="System.Int32"
                                                    UniqueName="Codice" ReadOnly="true">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="Percentuale" Visible="true" DataType="System.Int32" HeaderText="Percentuale"
                                                    UniqueName="Percentuale" ReadOnly="true">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridDateTimeColumn DataField="DataRilevamento" HeaderStyle-Width="40" HeaderText="Data Rilevamento"
                                                     DataType="System.DateTime" UniqueName="DataRilevamento" DataFormatString="{0:dd/MM/yyyy}">
                                                </telerik:GridDateTimeColumn>
                                                 <telerik:GridBoundColumn DataField="Note" Visible="true" DataType="System.String" HeaderText="Note"
                                                    UniqueName="Note" ReadOnly="false">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="NoteTestoSemplice" Visible="true" DataType="System.String" HeaderText="Note testo semlice"
                                                    UniqueName="NoteTestoSemplice" ReadOnly="false">
                                                </telerik:GridBoundColumn>
                                                
                                                <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" />
                                            </Columns>
                                            <HeaderStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                                                Font-Underline="False" HorizontalAlign="Left" VerticalAlign="Middle" Wrap="True" />
                                            <PagerStyle />
                                        </MasterTableView>
                                        <ClientSettings>
                                            <Selecting AllowRowSelect="true" />
                                        </ClientSettings>
                                        <GroupingSettings ShowUnGroupButton="false" CaseSensitive="false" />
                                        <SortingSettings EnableSkinSortStyles="true" />
                                    </telerik:RadGrid>
 
Thank you

6 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 11 Feb 2010, 04:11 PM
Hi Fabio,

 Could you paste your complete mark-up and code-behind. Please, use the code-formatter tool of the ticket editor. 

All the best,
Tsvetoslav
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
Fabio Laserra
Top achievements
Rank 1
answered on 24 Feb 2010, 03:02 PM
Hello
sorry for my delay. I have tried to abandon the automatic updates, for manual ones. I think there is something wrong. This code should be the simplest one (I have deleted a lot of columns and some other options), and should works, but when I click on  "Update" link, it does NOT post back, while "cancel" link works as espected. This is the code:

<asp:ObjectDataSource ID="objDataSourceGridSAL" runat="server" TypeName="xxx.ElencoTipologieInformazioni.Lavori_SAL_Controller" 
                                        DataObjectTypeName="xxx.ElencoTipologieInformazioni.Lavori_SAL_Info" 
                                        SelectMethod="FB_GetLavoriSAL"
                                        <SelectParameters> 
                                            <asp:Parameter Name="pintCodOpera" Type="Int32" /> 
                                            <asp:Parameter Name="pintCodLavoro" Type="Int32" /> 
                                        </SelectParameters> 
                                    </asp:ObjectDataSource> 
                                    <telerik:RadGrid runat="server" ID="RadGridSchedaLavori_SAL" DataSourceID="objDataSourceGridSAL" 
                                        AutoGenerateColumns="false" AllowAutomaticUpdates="false" AllowAutomaticDeletes="false" AllowAutomaticInserts="false" OnUpdateCommand="RadGridSchedaLavori_SAL_UpdateCommand" > 
                                        <PagerStyle Mode="NextPrevNumericAndAdvanced" /> 
                                        <MasterTableView   
                                            DataKeyNames="CodOpera,CodLavoro,Codice" PageSize="3" > 
                                            <NoRecordsTemplate>Nessun record presente!</NoRecordsTemplate> 
                                            <Columns> 
                                                <telerik:GridBoundColumn DataField="CodOpera" Visible="false" DataType="System.Int32" 
                                                    UniqueName="CodOpera" ReadOnly="false"
                                                </telerik:GridBoundColumn> 
                                                <telerik:GridBoundColumn DataField="CodLavoro" Visible="false" DataType="System.Int32" 
                                                    UniqueName="CodLavoro" ReadOnly="false"
                                                </telerik:GridBoundColumn> 
                                                <telerik:GridBoundColumn DataField="Codice" Visible="false" DataType="System.Int32" 
                                                    UniqueName="Codice" ReadOnly="false"
                                                </telerik:GridBoundColumn> 
                                                <telerik:GridEditCommandColumn> 
                                                </telerik:GridEditCommandColumn> 
                                            </Columns> 
                                        </MasterTableView> 
                                    </telerik:RadGrid> 
 
 

This is the code behind:
Protected Sub RadGridSchedaLavori_SAL_UpdateCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) 'Handles RadGridSchedaLavori_SAL.UpdateCommand 
            Dim a As String = "" 
        End Sub 

I suppose that the problem (in automatic and manual update) is the datasource, that is ObjectDataSource! :(
Thank you
0
Fabio Laserra
Top achievements
Rank 1
answered on 24 Feb 2010, 03:48 PM
I have founded the cause! (but not the solution :))
the issue is generated by RadAjaxManager. If I completely remove it, the update event fires as espected. So how can use a radgrid managed with RadAjaxManager
0
Tsvetoslav
Telerik team
answered on 26 Feb 2010, 06:48 AM
Hello Fabio,

RadAjaxManager does not have any problems when updating the RadGrid control. Your ajax settings should like the following:

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadGrid1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>

I hope this helps.

Regards,
Tsvetoslav
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
Avinash Thakur
Top achievements
Rank 1
answered on 20 Apr 2010, 06:18 PM
i am also not able to fire the Auto update event for the Radgrid.  am i missing any thing here? or is there any issue with radgrid?
   <div> 
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
        </telerik:RadScriptManager> 
    </div> 
    <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="ObjectDataSource2" GridLines="None" 
        AutoGenerateColumns="false" 
        <MasterTableView DataSourceID="ObjectDataSource2" EditMode="InPlace"
            <RowIndicatorColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
            </RowIndicatorColumn> 
            <ExpandCollapseColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
            </ExpandCollapseColumn> 
            <Columns> 
                <telerik:GridBoundColumn UniqueName="column1" DataField="Id" HeaderText="Id"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn UniqueName="column6" DataField="Type" HeaderText="Type"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn UniqueName="column5" DataField="StartInterval" HeaderText="StartInterval"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn UniqueName="column2" DataField="EndInterval" HeaderText="EndInterval"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn UniqueName="column3" DataField="ColorCode" HeaderText="ColorCode"
                </telerik:GridBoundColumn> 
                <telerik:GridEditCommandColumn> 
                </telerik:GridEditCommandColumn> 
            </Columns> 
        </MasterTableView> 
    </telerik:RadGrid> 
    <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" SelectMethod="GetMonitorRules" 
        TypeName="TelerikTest.DB_JSQWFDevDB1.Test3" UpdateMethod="UpdateMonitorRules">     
        <UpdateParameters> 
            <asp:Parameter Name="ID" Type="String" /> 
            <asp:Parameter Name="TYPE" Type="String" /> 
            <asp:Parameter Name="StartInterval" Type="DateTime" /> 
            <asp:Parameter Name="EndInterval" Type="DateTime" /> 
            <asp:Parameter Name="ColorCode" Type="String" /> 
        </UpdateParameters> 
    </asp:ObjectDataSource> 
0
Avinash Thakur
Top achievements
Rank 1
answered on 20 Apr 2010, 06:31 PM
i was missing "AllowAutomaticUpdates="true"". Now it is working fine:)
Tags
Grid
Asked by
Fabio Laserra
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Fabio Laserra
Top achievements
Rank 1
Avinash Thakur
Top achievements
Rank 1
Share this question
or