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

datagridrow.ItemType property returns undefined

9 Answers 106 Views
Grid
This is a migrated thread and some comments may be shown as answers.
rajani ramineni
Top achievements
Rank 1
rajani ramineni asked on 30 Jan 2009, 10:07 PM
Hi iam trying to find out if grid is in edit mode on a button click which is out side the grid.

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

Sort by
0
Nikolay Rusev
Telerik team
answered on 02 Feb 2009, 07:59 AM
Hello Rajani,

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.
0
rajani ramineni
Top achievements
Rank 1
answered on 02 Feb 2009, 01:52 PM
Hi Nikolay,

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
0
Nikolay Rusev
Telerik team
answered on 03 Feb 2009, 03:43 PM
Hello 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.
0
rajani ramineni
Top achievements
Rank 1
answered on 04 Feb 2009, 01:19 AM
Hi Nikolay,

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
0
Nikolay Rusev
Telerik team
answered on 04 Feb 2009, 06:35 AM
Hi 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.
0
rajani ramineni
Top achievements
Rank 1
answered on 04 Feb 2009, 07:33 PM
Hi Nikolay,

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
0
Nikolay Rusev
Telerik team
answered on 06 Feb 2009, 10:07 AM
Hello 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.
0
rajani ramineni
Top achievements
Rank 1
answered on 06 Feb 2009, 03:40 PM
Thanks Nikolay,

But is there any other way or can you suggest any other way through which i can do this, with out upgrading

Regards
Rajani
0
Nikolay Rusev
Telerik team
answered on 09 Feb 2009, 09:06 AM
Hello 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.
Tags
Grid
Asked by
rajani ramineni
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
rajani ramineni
Top achievements
Rank 1
Share this question
or