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

JScript runtime error undefined is null or not an object

11 Answers 222 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Les
Top achievements
Rank 1
Les asked on 10 Feb 2011, 01:58 PM

Hi Guys,

I am using the telerik grid with MVC3 and ajax databound. The records are binding no problem there, but every so often (intermittent) when I edit a record (inline) the following message is thrown in VS2010.

  1. Microsoft JScript runtime error: 'undefined' is null or not an object. The error is relating to a function in jquery-1.4.3.min.jswhich is.. 
    {return j==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===j}

I am using the same record for test purposes. I page and refresh inbetween before editing the record again. 70% of times the edited record is persisted to the database (using entity framework) but as mentioned above.. itermittently the above message is thrown. I am doing nothing different, which may explain the behaviour e.g. I am just adding /removing upper/lower case characters to the record in the grid.

2. Chaning the editing mode to 'Pop-Up'
    When I change the edit mode to 'Pop-Up' and edit a record the window is displayed. Sometimes when I click cancel, VS2010 breaks with an 
    error in the telerik.grid.editing.min.js script at the following function..

h.data("tWindow").close()

I have configured the ScriptRegistrar in the following format.. which I took from another forum post.
@Html.Telerik().ScriptRegistrar().DefaultGroup(group => 
{
 group.DefaultPath("~/Scripts/");
    group.Add("~/Scripts/MicrosoftAjax.js");
    group.Add("~/Scripts/MicrosoftMvcAjax.js");
    group.Add("~/Scripts/MicrosoftMvcValidation.js");
});

Not sure if point 1 and 2 are related. I appreciate any comments which you may have on this subject.

Thanking you for your support as ever.

Les

11 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 10 Feb 2011, 02:47 PM
Hello Les,

 We are not aware of these problems. Can you reproduce them in any of our online demos?

All the best,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Les
Top achievements
Rank 1
answered on 10 Feb 2011, 03:48 PM
Atanas,

Couldn't reproduce the symptoms with the online editing demo. What I did forget to mention is that I am running IE9 beta. I will take a further look at the code.. and revert. I just find it strange that it works for 70% of the time.. and then every so often I encounter an error.

Thank you for your reply.

Les
0
Les
Top achievements
Rank 1
answered on 10 Feb 2011, 05:52 PM
Atanas,

I am presently reviewing your online demo for ajax editing. When I include the line ..
GridEditMode mode = (GridEditMode)ViewData["mode"];

I receive a NullReferenceException - Object reference not set to an instance of an object. Code matches your example.. any suggestions?

@{ 
    GridEditMode mode = (GridEditMode)ViewData["mode"];
  
    using (Html.Configurator("Edit mode")
        .PostTo("GridEditingMode", "Classification")
        .Begin())
    {
        <ul>
            <li>@Html.RadioButton("mode", "InLine", mode == GridEditMode.InLine, new { id = "inLine" }) <label for="inLine">In-Line Editing</label></li>
            <li>@Html.RadioButton("mode", "InForm", mode == GridEditMode.InForm, new { id = "inForm" }) <label for="inForm">In-Form Editing</label></li>
            <li>@Html.RadioButton("mode", "PopUp", mode == GridEditMode.PopUp, new { id = "popUp" }) <label for="popUp">Pop-Up Form Editing</label></li>
        </ul>
        <br />
        <button type="submit" class="t-button t-state-default">Apply</button>
  
    }
}


Les
0
Les
Top achievements
Rank 1
answered on 11 Feb 2011, 01:44 AM
I am trying to replicate the demo code you have up on your site for Razor,  as per previous posts, GridEditMode mode =(GridEditMode)ViewData["mode"] returns null exception so..

..I added the following..

//GridEditMode mode = (GridEditMode) ViewData["mode"];

 

 

GridEditMode mode = new GridEditMode();

ViewData["mode"] = mode;


Now I can pass the GridEditMode to the Method, but on the view return it fails to route correctly..
<fieldset title="Menu">
    <legend>Menu</legend>
    @using (Html.Configurator("")
        .PostTo("GridEditingMode","Classification")
        .Begin())
        {
            @( Html.Telerik().TabStrip()
                    .Name("Grid Editing Options")
                    .SelectedIndex(0)
                    .Items(items =>
                    {
                        items.Add()
                            .Text("Grid Edit Options")
                            .Content(
                                 @<text>
                                    <ul>
                                        <li>@Html.RadioButton("mode", "PopUp",true,newDict.TryGetValue("popUp",out EditMode)) <label for="popUp">Pop-Up Form Editing</label></li>
                                        <li>@Html.RadioButton("mode", "InLine",true,newDict.TryGetValue("inLine",out EditMode)) <label for="popUp">In-Line Form Editing</label></li>
                                        <li>@Html.RadioButton("mode", "InForm",true,newDict.TryGetValue("inForm",out EditMode)) <label for="popUp">In-Form Form Editing</label></li>
                                        @*
                                        <li>@Html.RadioButton("mode", "PopUp", mode == GridEditMode.PopUp, new { id = "popUp" }) <label for="popUp">Pop-Up Form Editing</label></li>
                                        <li>@Html.RadioButton("mode", "InLine", mode == GridEditMode.InLine, new { id = "inLine" }) <label for="inLine">In-Line Editing</label></li>
                                        <li>@Html.RadioButton("mode", "InForm", mode == GridEditMode.InForm, new { id = "inForm" }) <label for="inForm">In-Form Editing</label></li>
                                        *@
                                    </ul>
                                    <br />
                                    <button type="submit">Apply</button>
                                </text>);
                    })
            )
        }   
</fieldset>

The following error is returned
Exception Details: System.InvalidOperationException: The view 'GridEditingMode' or its master was not found. The following locations were searched:

...
...
~/Views/Classification/GridEditingMode.cshtml



Thanks again for any help offered.

Les
0
Atanas Korchev
Telerik team
answered on 11 Feb 2011, 09:32 AM
Hello Les,

 The code from the editing demo is for example purposes. You don't need that in your code.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Les
Top achievements
Rank 1
answered on 14 Feb 2011, 11:44 AM
Good morning.

I have the application  successfully running CRUD operations. The runtime error when using the pop-up floating menu still remains however. The error is not persistent when I post an update to the database, but rather manifests itself when I choose to press the cancel button in the pop-up menu and then do a re-fresh on the grid or page forward/back.

VS breaks on :
function f(j){var i=function(){h.data("tWindow").close();

h.data  
function(a,b)
{
if(typeof a==="undefined")
return this.length?c.data(this[0]):null;
else if(typeof a==="object")
return this.each(function(){c.data(this,a)});
var d=a.split(".");
d[1]=d[1]?"."+d[1]:"";
if(b===A){var e=this.triggerHandler("getData"+d[1]+"!",[d[0]]) Object, (Function)

This error only affects pop-up mode, inline and in-form are fine,when I cancel and edit and refresh or page. Running IE9 beta.

Again, thanks for your help to date.

Les
0
Atanas Korchev
Telerik team
answered on 14 Feb 2011, 12:45 PM
Hello Les,

 We still cannot reproduce this problem and that's why we asked you to try our online demos. We cannot do anything until we reproduce it. By the way IE 9 RC was released last week. You can try upgrading to that version and see if the problem is resolved.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Les
Top achievements
Rank 1
answered on 14 Feb 2011, 05:00 PM
Hi,

Thanks for the reply. I cannot re-produce the error with your online demo. I made further changes, but still it keeps coming up with the same script error. Out of a matter of interest, your online demo.. what type of model does it expect for the View e.g.

@model IEnumerable<MyMVC3.Models.ClassificationViewModel>

Les
0
Atanas Korchev
Telerik team
answered on 15 Feb 2011, 08:44 AM
Hi Les,

 The code of our online demo is part of the distribution. You can download it and try it in Visual Studio. The Razor examples are available as a separate download from the downloads section in our web site.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Les
Top achievements
Rank 1
answered on 15 Feb 2011, 01:23 PM
Hi Guys,

I downloaded the sample code.. and everything looked in order when I compard it with mine. I took a look at the erroring script more closely and decided to replace it in the end. After doing so.. the issue resolved itself!

Thanks ever so much for all your responses.

Les
0
Merritt
Top achievements
Rank 1
answered on 11 Mar 2011, 11:23 PM
I get the exact same error in the exact same scenario; then updated to the latest version and things worked fine.
Tags
Grid
Asked by
Les
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Les
Top achievements
Rank 1
Merritt
Top achievements
Rank 1
Share this question
or