The isItemInserted() property is working fine which tells me it he grid is in insert mode but the datagridrow.ItemType always returns an error saying undefined, following the code, Please tell me if iam doing any mistake.
var grid=$find("<%=rgSynonym.ClientID%>");
var flag = false;
var rowCount = grid.get_masterTableView().get_dataItems().length;
var dataItems = grid.get_masterTableView().get_dataItems()
alert(grid.get_masterTableView().get_isItemInserted());
if (grid.get_masterTableView().get_isItemInserted()) {
flag = true;
}
for (var i = 0; i < rowCount; i++) {
var row = dataItems[i].get_element();
alert(row.ItemType);
if (row.ItemType == "EditFormItem") {
var flag = true;
alert("grid is in edit mode");
// Cancel the Event so that command edit mode is maintained
break
//your code
}
}
if (!flag) {
alert("grid is in regular mode");
}
Regards
Rajani
9 Answers, 1 is accepted
The code you use
var row = dataItems[i].get_element(); |
row.ItemType |
takes current DataItem html element, i.e html row and then you are trying to access to that html row ItemType property. This is wrong.
If you need to check what is current edit mode type of any GridTableView you can use the code below:
$find("RadGrid1").get_masterTableView()._data.EditMode |
I hope this helps.
Best wishes,
Nikolay
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
First of all thanks for responding
But it still returns undefined. where as it should be indicating something like editmode as iam running this code on a button click keeping one of the grid rows in edit mode.
Please help me
Regards
Rajani
Please make sure that you are using latest version of RadControls for ASP.NET AJAX.
ItemType property is used in RadGrid for ASP.NET.
You can easily test the code which I suggest you in my previous post on this demo: Automatic operations
Regards,
Nikolay
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Iam sorry but i didnt understand you are mentioning about your post.
i want to find out if any rows of radgrid are edit mode in javascript (not in code behind).
Please help me
Regards
Rajani
What I've tried to explain in my previous post was that ItemType on client side is property of RadGrid.Row object from RadControls for ASP.NET suit.
From the code which you posted I can see that you are suing RadGrid from RadControls for ASP.NET AJAX suit and I suggest you to make sure which of both version you are using. If you are using version 2008.3.13.14 of RadControls for ASP.NET AJAX the code which I suggest you should be working, i.e there is a property on every GridTableView on client-side which determines what is current edit mode for all the items in this table view.
Basically yourRadGridClientSideObject.CocreteGridTableVIew._data.EditMode.
Regards,
Nikolay
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
the version of telerik controls iam using is 2008.1.619.35 and i cant upload it to new version at this point so is there any way i can check if rows are in edit mode in javascript for this version of controls.
Regards
Rajani
I am afraid that in version 2008.1.619.35 of RadGrid for ASP.NET AJAX you will not be able to determine what is the current edit mode of grid control neither if current item is in edit mode. I suggest you to upgrade to latest version of RadControls for ASP.NET AJAX.
All the best,
Nikolay
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
But is there any other way or can you suggest any other way through which i can do this, with out upgrading
Regards
Rajani
I am afraid that in this version of RadGrid for ASP.NET AJAX there is no way to determine if Item is in edit mode completely client-side.
Sincerely yours,
Nikolay
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.