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

UpdateCommand (or any other ItemCommand) not firing

8 Answers 492 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Hendrik
Top achievements
Rank 2
Hendrik asked on 15 Aug 2008, 09:45 AM
I've seen a lot of posts about ItemCommand events not firing, but no solution in any of the topics. My problem is simple and shouldn't require a complete code sample or whatever: I have a RadGrid within a UserControl, dynamicaly being loaded on a page, within a PlaceHolder using LoadControl. I use inline editing for the grid, using my own code to update the underlying database. The UpdateCommand fired after clicking the update button in de editcommand column should be the place to do so. Going into edit mode works fine, but when clicking either the cancel button or the update button, doen's fire any event.

The page structure is like this: Master > Content > RadSplitter > RadPane > RadAjaxPanel > PlaceHolder > UserControl > RadAjaxPanel > RadGrid.

Please give me a solution for this problem. FYI:'the grid has the OnUpdateCommand property set with my event handlers name and the AllowAutomatedUpdates property is set to true. Everything SHOULD work fine.... but it doesn't.

8 Answers, 1 is accepted

Sort by
0
Konstantin Petkov
Telerik team
answered on 18 Aug 2008, 07:18 AM
Hello Hendrik,

What I suspect here is a problem with the way of loading the user control dynamically which often appears when using AJAX. To verify that, would you please try removing the AJAX Panels from the setup temporary and see if the events are fired as expected? If I'm right in my assumptions, please review the tutorial available in the documentation here about loading user controls.

I'd also suggest you switch to the RadAjaxManager/Proxy setup instead. You can read more about that in the following help articles:

RadAjax and WebUserControls
Using RadAjaxManagerProxy control

Regards,
Konstantin Petkov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
David
Top achievements
Rank 1
answered on 01 Dec 2008, 10:39 AM
Hi there,
I am having the same problem. I have wired up my OnUpdateCommand as Hendrik has. I have tried moving the grid to a non-Ajax panel and the update event is still not firing. The ItemCommand is firing as expected (to open the row in edit mode), but when I try to update it, no event gets fired...

Here is the code for the RadGrid in the ascx; Does everything look right?

 

<telerik:RadGrid ID="grdGauges" runat="server" Skin="Gray" AutoGenerateColumns="False"   
                                                ShowHeader="false" onupdatecommand="grdGauges_UpdateCommand"   
                                                onitemcommand="grdGauges_ItemCommand" EnableViewState="true"   
                                    AllowAutomaticUpdates="true" onitemupdated="grdGauges_ItemUpdated" > 
                                    <MasterTableView EditMode="EditForms" DataKeyNames="Type">  
                                        <RowIndicatorColumn> 
                                            <HeaderStyle Width="20px" /> 
                                        </RowIndicatorColumn> 
                                        <ExpandCollapseColumn> 
                                            <HeaderStyle Width="20px" /> 
                                        </ExpandCollapseColumn> 
                                        <Columns> 
                                            <telerik:GridEditCommandColumn ButtonType="LinkButton" UniqueName="clEdit"></telerik:GridEditCommandColumn> 
                                            <telerik:GridBoundColumn DataField="Type" HeaderText="Type" ReadOnly="true" UniqueName="Type">  
                                            </telerik:GridBoundColumn> 
                                            <telerik:GridBoundColumn DataField="SerialNumber" HeaderText="Serial No." UniqueName="SerialNumber">  
                                            </telerik:GridBoundColumn> 
                                        </Columns> 
                                    </MasterTableView> 
                                    <FilterMenu EnableTheming="True" Skin="Gray">  
                                        <CollapseAnimation Duration="200" Type="OutQuint" /> 
                                    </FilterMenu> 
                                </telerik:RadGrid> 

 

 

0
Vlad
Telerik team
answered on 01 Dec 2008, 01:04 PM
Hi David,

Can you please post a bit more info how this user control is loaded/created?

Kind regards,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
David
Top achievements
Rank 1
answered on 01 Dec 2008, 04:51 PM
Hi Vlad,
thanks for getting back to me.

I managed to find a simple solution... i've updated my grid so  that it now uses the advanced data binding method, rather than the simple grid.DataBind() method.
This allowed the UpdateCommand/InsertCommand/DeleteCommand events to be fired, and they still work as expected when I add them to a RadAjaxPanel.

Cheers
David
0
Wveimar
Top achievements
Rank 1
answered on 15 May 2009, 03:45 PM
Hi everybody:

Verify you don't have any .NET validators (RequiereFieldValidator, CompareValidator, etc) in your page waiting for data. In my case that was the problem.  I have a page with one RadDockLayout, two RadDockZones, and a RadDock inside every zone.  Every RadDock contains a UserControl, and one of them have validators. If those validators get fired when you fired the OnInsertCommand or OnUpdateCommand, none of them will get fired.

WLopez
0
Jason Zam
Top achievements
Rank 1
answered on 18 Aug 2009, 03:18 AM
I've had that same frustrating problem as well.  Like Wveimar, I was using a RadGrid within a RadDockLayout/RadDockZones/RadDock.  For the life of me, I could not get the Update/Insert Commands to fire for this RadGrid within thr RadDock.  I tried testing the same exact RadGrid example but this time placing it outside of the RadDock and it worked fine, the events were being fired

After a few hours of pulling my hair out, I realized that I had the following two attributes set in my RadDockLayout which were the source of the problem.  Once I removed the attributes, the Update/Insert Commands were firing.

 

EnableViewState="False"
StoreLayoutInViewState="False"

 

0
Neerav
Top achievements
Rank 1
answered on 02 Dec 2010, 12:14 PM

Dear Telerik staff,
I have a empty "RadGrid1" and hyper links "A","ALL"...  on default.aspx page.
 On click of "ALL" I have opened a new window pop up using  "RadWindow" with radopen = ("default.aspx", radwindowID) method. This will pop up the window on same(default.aspx) page. Now this radwindow is defined on default.aspx page with a another radgrid "radgrid2" in it using content template tags of radwindow. The radgrid2 also has a template column with command = "move to selected" which on click will move the corresponding row from radgrid2 to radgrid1 and hide that row in radgrid2. This process can fill up radgrid1(which was empty). The radgrid2 has "onitemcommand  = "radgrid1_itemcommand"" property set to handle click event from template column (command name = "move to selected"), this property  has logic for hiding row in radgrid2 and moving row to radgrid1.

Now I have been able to open the window on same page with radgrid2 in it with template column "+" in it.
The page get loads and all GUI gets displayed properly along with radgrid1 and links. WHen I click "ALL" the radwindow gets pop up with data filled radgrid2 with template column "+" in it.
 The problem is, when I click "+" i.e. template column for first time the "radgrid1_itemcommand" method does not get fired. But from second click onwards the command gets fired and all workds well (i.e. rows get move to radgrid1 from radgrid2).
On click of template column the radgrid1_itemcommand does not gets fired for first time and because of that, the row does not get move from radgrid2 to radgrid1  only for first time. BUt ll works on and after second click on template column.

PFA the images of my current scenario where "Radgrid_image1" is image where I click on "+" for first time and nothing happens and "radgrid_image2" is image where the row moves to radgrid1 and get hidden in radgrid2.

 Ihave used following

 

<telerik:RadAjaxManager runat="server" ID="radAjax" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid2">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid2"/>
<telerik:AjaxUpdatedControl ControlID="RadGridfirst" />

</UpdatedControls>
</telerik:AjaxSetting>
</telerik:RadAjaxManager>

Important thing that when I comment the above ajax setting code, all start to work well even for firts time i.e. rows gets shifted from from first click on template column. But this process closes the radwindow every time the template column getsclicked, so I have to click "ALL" again for opning the radwindow which is not at all my requirement.

Kindly reply

Thanks and Regards

 

0
Maria Ilieva
Telerik team
answered on 07 Dec 2010, 04:27 PM
Hi Neerav,

Please test the suggestion provided in the official support ticket opened for this issue.

Kind regards,
Maria Ilieva
the Telerik team

Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
Hendrik
Top achievements
Rank 2
Answers by
Konstantin Petkov
Telerik team
David
Top achievements
Rank 1
Vlad
Telerik team
Wveimar
Top achievements
Rank 1
Jason Zam
Top achievements
Rank 1
Neerav
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or