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.
- 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
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
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
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
..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
The code from the editing demo is for example purposes. You don't need that in your code.
Regards,Atanas Korchev
the Telerik team
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
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
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
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
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