I set up my grid for a row to go into Edit Mode when it's double clicked. This works fantastic. My problem is when I click 'New', a new blank record appears, I enter some info, then instead of clicking Insert, I double click on another row. I get the following error:
only items with IsInEditMode set to true can be updated.
My code is copied from Telerik's demo. Any ideas?
only items with IsInEditMode set to true can be updated.
My code is copied from Telerik's demo. Any ideas?
6 Answers, 1 is accepted
0
Hello Tara,
Test the following approach:
Let me know whether this helps.
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.
Test the following approach:
<script type="text/javascript"> |
<!-- |
var hasChanges, inputs, dropdowns, editedRow; |
function RowClick(sender, eventArgs) |
{ |
if (editedRow != null && hasChanges) |
{ |
if (confirm("Confirm changes?")) |
{ |
hasChanges = false; |
if (!eventArgs.get_tableView().get_isItemInserted()) |
$find("<%= RadGrid1.MasterTableView.ClientID %>").updateItem(editedRow); |
else |
$find("<%= RadGrid1.MasterTableView.ClientID %>").insertItem(); |
} |
else |
hasChanges = false; |
} |
} |
function RowDblClick(sender, eventArgs) |
{ |
if (editedRow === undefined && hasChanges) |
{ |
if (eventArgs.get_tableView().get_isItemInserted()) |
{ |
eventArgs.get_tableView().insertItem(); |
return; |
} |
} |
if (editedRow && hasChanges) |
{ |
if (confirm("Confirm changes?")) |
{ |
hasChanges = false; |
$find("<%= RadGrid1.MasterTableView.ClientID %>").updateItem(editedRow); |
} |
else |
hasChanges = false; |
} |
editedRow = eventArgs.get_itemIndexHierarchical(); |
$find("<%= RadGrid1.MasterTableView.ClientID %>").editItem(editedRow); |
} |
function GridCreated(sender, eventArgs) |
{ |
var gridElement = sender.get_element(); |
var elementsToUse = []; |
inputs = gridElement.getElementsByTagName("input"); |
for (var i = 0; i < inputs.length; i++) |
{ |
if (inputs[i].type.toLowerCase() == "hidden") |
{ |
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> |
Let me know whether this helps.
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

TPerry
Top achievements
Rank 1
answered on 17 Feb 2009, 04:05 PM
Hi Daniel - I tried your proposed solution and I'm getting null is undefined on the following line:
$find(
"<%= GridFees.MasterTableView.ClientID %>").insertItem();
I even replaced that line with this one:
$find(
"<%= GridFees.MasterTableView.ClientID %>").updateItem(editedRow);
And it gave me the same error (null is undefined).
Thoughts?
0
Hi TPerry,
Do you have latest version of Telerik.Web.UI?
All the best,
Vlad
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.
Do you have latest version of Telerik.Web.UI?
All the best,
Vlad
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

TPerry
Top achievements
Rank 1
answered on 19 Feb 2009, 01:46 PM
I have ASP AJAX Q3 2008.
0
Accepted
Hello Tara,
Please download the attached example and let me know how to reproduce this issue.
Thank you for your cooperation.
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.
Please download the attached example and let me know how to reproduce this issue.
Thank you for your cooperation.
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

TPerry
Top achievements
Rank 1
answered on 27 Mar 2009, 05:34 PM
I apologize for taking so long to get back to you, but this was exactly what I needed. Thank you!!