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

Edit on double-click demo error

4 Answers 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joseph
Top achievements
Rank 2
Joseph asked on 25 Aug 2008, 08:18 PM
I was looking at ideas for a project I'm currently working on - and I was trying out some stuff on your demo site.  Specifically, the demo which shows how to edit on double-click.  While doing so, I found a possible issue.

Here are the steps to recreate the issue:

1) Goto: http://www.telerik.com/DEMOS/ASPNET/Prometheus/Grid/Examples/DataEditing/EditOnDblClick/DefaultCS.aspx
2)  Double click on a row to edit it.
3) Make a change to the data
4) Click on the pager to navigate to page 2
5) Click on the pager to navigate back to page 1
6) Double click on the same row to edit it - you will get a popup which asks Update Changes?
7) Click OK
8) Site error message displays.

I'm just guessing here, but it seems like using the pager to navigate doesnt trigger a check to see if the data has changed - but when you come back to the page and double-click - it knows the data was changed but that data is now inaccessible and the update fails.

4 Answers, 1 is accepted

Sort by
0
Konstantin Petkov
Telerik team
answered on 27 Aug 2008, 05:47 AM
Hello Joseph,

I just tried that but cannot get the error:

http://demos.telerik.com/aspnet/prometheus/Grid/Examples/DataEditing/EditOnDblClick/DefaultCS.aspx


I change the data the first time, but does not submit the change, should I? Moving forth and back to the same page and changing/updating the same value functions properly and the value is updated without any error.

The demo runs with the new version of RadControls for ASP.NET AJAX Q2 2008 Service Pack 1 but we have not changed the demo recently. Let us know if I'm missing a detail from the required steps.

All the best,
Konstantin Petkov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Roy
Top achievements
Rank 1
answered on 27 Aug 2008, 06:01 AM
I have the same problem...
I checked it again on the demo, and it has the same problem.
Scenario:
Dblclicked a row, changed a value, paged without saving,
paged back, edited the same row again, and boom...
0
Konstantin Petkov
Telerik team
answered on 27 Aug 2008, 06:06 AM
Hi,

Indeed, I was able to reproduce the error. We will investigate it as soon as possible and find a way to resolve that.

Thank you for notifying us about that, guys!

All the best,
Konstantin Petkov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Konstantin Petkov
Telerik team
answered on 27 Aug 2008, 11:46 AM
Hello,

Just a follow-up -- the problem is already addressed. You will the live demo updated shortly as well. The JavaScript is updated as follows:

        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
        <script type="text/javascript"
        <!-- 
            var hasChanges, inputs, dropdowns, editedRow; 
             
            function RowClick(sender, eventArgs) 
            { 
                if(editedRow && hasChanges) 
                { 
                    hasChanges = false
                    if(confirm("Update changes?")) 
                    { 
                         
                        $find("<%= RadGrid1.MasterTableView.ClientID %>").updateItem(editedRow); 
                    } 
                } 
            } 
 
            function RowDblClick(sender, eventArgs) 
            { 
                editedRow = eventArgs.get_itemIndexHierarchical(); 
                $find("<%= RadGrid1.MasterTableView.ClientID %>").editItem(editedRow); 
            } 
 
            function GridCommand(sender, args) 
            { 
                if (args.get_commandName() != "Edit") 
                { 
                    editedRow = null
                } 
            } 
 
            function GridCreated(sender, eventArgs) 
            { 
                var gridElement = sender.get_element(); 
                var elementsToUse = []; 
                inputs = gridElement.getElementsByTagName("input"); 
                for (var i = 0; i < inputs.length;i++) 
                { 
                    var lowerType = inputs[i].type.toLowerCase(); 
                    if(lowerType == "hidden" || lowerType == "button") 
                    { 
                        continue; 
                    } 
                     
                    Array.add(elementsToUse, inputs[i]); 
                    inputs[i].onchange = TrackChanges
                } 
                 
                dropdowns = gridElement.getElementsByTagName("select"); 
                for (var i = 0; i < dropdowns.length;i++) 
                { 
                    dropdowns[i].onchange = TrackChanges
                } 
 
                setTimeout(function(){if(elementsToUse[0])elementsToUse[0].focus();},100); 
            } 
 
            function TrackChanges(e) 
            { 
                hasChanges = true
            } 
        -->  
    </script> 
    </telerik:RadCodeBlock> 

where GridCommand is the handler of OnCommand client event:

<telerik:RadGrid ...> 
    ... 
    <ClientSettings> 
        <ClientEvents ... OnCommand="GridCommand"/> 
    </ClientSettings> 
</telerik:RadGrid> 

Regards,
Konstantin Petkov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Joseph
Top achievements
Rank 2
Answers by
Konstantin Petkov
Telerik team
Roy
Top achievements
Rank 1
Share this question
or