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

How to find out whether the grid is in Edit/Insert Mode using JavaScript?

1 Answer 106 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mahidhura
Top achievements
Rank 1
Mahidhura asked on 29 Sep 2008, 09:13 PM
Hi I am using the below code to     examine whether Grid is edit mode or not.
but I am getting the error (JS Error)      grid.MasterTableView.Rows.length

Am I doing it right.

Thanks in advance  for the help.


   function DetectMode() {
                var flag = false;
                // Get the radGrid Reference
                var grid = $find("<%= CompanyGrid.ClientID %>");

                for (var i = 0; i < grid.MasterTableView.Rows.length; i++) {
                   // Check if the currenr row is in edit mode or not?               
                    if (grid.MasterTableView.Rows[i].ItemType == "EditFormItem") {
                        var flag = true;
                        alert("grid is in edit mode");
                        // Cancel the Event so that command edit mode is maintained
                        break;
                    }
                }
                if (!flag) {
                    alert("grid is in regular mode");
                }
               
            }

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 30 Sep 2008, 03:41 AM
Hi,

Try accessing the row length as shown below.

JS:
function DetectMode() 
 { 
                 
   var flag = false
   var RadGrid1 = $find("<%= RadGrid2.ClientID %>"); 
   var rowCount=  RadGrid1.get_masterTableView().get_dataItems().length; 
        
     for (var i = 0; i < rowCount; i++) 
        { 
         //your code 
        } 
    
    if (!flag) 
    { 
                 
    alert("grid is in regular mode"); 
               
    } 
 } 


Regards
Shinu.
Tags
Grid
Asked by
Mahidhura
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or