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

Microsoft JScript runtime error: Object doesn't support this property or method

3 Answers 229 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Geoffrey
Top achievements
Rank 1
Geoffrey asked on 30 Dec 2010, 05:21 PM
Hello,

I'm getting this error message (Microsoft JScript runtime error: Object doesn't support this property or method) every time I attempt to retrieve the row selected from the RadGrid control. The error message is thrown after clicking a record in the grid.

I noticed through reading other forms that this may be related to an outdated Telerik.Web.UI reference. Therefore, I have already updated my project Telerik.Web.UI references to the latest version in an attempt to fix this problem. My current Telerik.Web.UI version is 2010.3.1215.40. I'm running Visual Studio 2010.

<script type="text/javascript">
    var grid;
    
    function RowSelected(rowObject)
    {
      var selRow = this.GetCellByColumnUniqueName(rowObject,"Username");        <------ this is the line that is throwing the error.*
      //here selRow.innerHTML will hold the value for the selected row user name
    }

function GridCreated()
{
  grid = this;
}
</script>

Thanks for your help,

Geoffrey Rees

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 31 Dec 2010, 05:20 AM
Hello Geoffrey,

Try the following approach to get the cell value of selected row from client side.

Java Script:
<script type="text/javascript">
    function RowSelected(sender, eventArgs) {
        var grid = sender;
        var MasterTable = grid.get_masterTableView();
        var row = MasterTable.get_dataItems()[eventArgs.get_itemIndexHierarchical()];
        var selRow = MasterTable.getCellByColumnUniqueName(row, "Username");
       //here selRow.innerHTML will hold the value for the selected row user name
    }
</script>

Thanks,
Princy.
0
Geoffrey
Top achievements
Rank 1
answered on 04 Jan 2011, 05:56 PM
Princy,

I tried your client side script and when I click a record, I'm still getting the same error message "Microsoft JScript runtime error: Object doesn't support this property or method" at the line of code below.

"varMasterTable = grid.get_masterTableView();"

Thanks again for your help!

Geoffrey Rees
0
Princy
Top achievements
Rank 2
answered on 05 Jan 2011, 07:50 AM
Hello Geoffrey,

I guess the error is occuring bacause you are not accessing the grid client object in RowSelected event. You can directly get the grid client object by setting grid=sender in RowSelected event.

Java Script:
<script type="text/javascript">
    function RowSelected(sender, eventArgs) {
        var grid = sender;
        var MasterTable = grid.get_masterTableView();
        .  .  .  .  .   .  .  .
    }
</script>


Thanks,
Princy.
Tags
Grid
Asked by
Geoffrey
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Geoffrey
Top achievements
Rank 1
Share this question
or