Script error editing grid row

I have set up an MVC grid with dialog editing enabled. When I double-click on a row, I get an error in Visual Studio 2010 "Microsoft JScript runtime error: Object doesn't support property or method 'sfEvalScripts' and the error window highlights this line of code in a dynamic script block:

$.fn.sfEvalScripts(response);

I'm guessing this is a simple configuration error. Any idea what I am missing?


7 Replies

ES Eswari S Syncfusion Team October 12, 2011 07:30 AM UTC

Hi Jim,

We were unable to reproduce the issue .We suspect that you would have missed some of the scripts that are needed for editing. Please refer to the following steps:

Step #1 : Add the MicrosoftMvcValidation.debug.js file in the Site.Master page.

. . .





Step #4: Add the following script files when the UnobtrusiveJavaScriptEnabled is true in web.config file.

[Web.config]



. . .
// if it is true ,add the following script files


[Site.Master]

. . . .
. . . .








For your convenience, we have prepared the sample and the same can be downloaded from the following link :

Dialog Editing-64522197.zip

Could you please try the above sample and get back to us whether you are able to reproduce the issue? If not, could you please give more information or by reproducing the issue in the above sample so that we could sort out the issue and provide you with solution. The information provided would be of great help in resolving the issue.

Please let us know if you need any further assistance.

Regards,
Eswari.S





JB Jeremy Branham August 1, 2013 02:47 AM UTC

I am experiencing the same problem.
Edit works fine in a child grid, but fails in a parent grid.
I'm using a layout page with the script references, so I know they are identical.
 
I've found the sfEvalScripts function gets 'undefined' when you click the edit button.
 
Example - [The first time I put the reference in the console, it was a valid value. Then after clicking the edit button, the function is undefined]

>> $.fn.sfEvalScripts

function (content, isUnObtrusive) { var matches = $.fn.sfEvalScripts.parseScript(content, $.fn.sfEvalScripts.defaults.pattern); if (matches.length > 0) { $.fn.sfEvalScripts.executeScripts(matches, isUnObtrusive); {
parseScript : function (input, pattern) { var re; try { re = new RegExp(pattern); } catch (ex) { alert(ex.message); } var results = new Array() var arr = re.exec(input) ,
Match : function () { this.Value = null; this.Groups = new Array(); },
executeScripts : function (matches, isUnObtrusive) { var sCount = 0; for (sCount = 0; sCount < matches.length; sCount++) { var match = matches[sCount]; for (var j = sCount - 2; j > -1; ) { if (j > -1) { ,
defaults : [object Object],
callBaseMethod : function(a,d,b){var c=Sys._getBaseMethod(this,a,d);if(!b)return c.apply(a);else return c.apply(a,b)},
getBaseMethod : function(a,b){return Sys._getBaseMethod(this,a,b)},
getBaseType : function(){return typeof this.__baseType==="undefined"?null:this.__baseType},
getInterfaces : function(){var a=[],b=this;while(b){var c=b.__interfaces;if(c)for(var d=0,f=c.length;d<f;d++){var e=c[d];if(!Array.contains(a,e))a[a.length]=e}b=b.__baseType}return a},
getName : function(){return typeof this.__typeName==="undefined"?"":this.__typeName},
implementsInterface : function(d){this.resolveInheritance();var c=d.getName(),a=this.__interfaceCache;if(a){var e=a[c];if(typeof e!=="undefined")return e}else a=this.__interfaceCache={};var b=this;while(b){var f=b.__interfaces;if(f)if(Array.indexOf(f,d)!==-1)return a[c]=true;
...
}

Add to watch

>> $.fn.sfEvalScripts undefined



AR Ajith R Syncfusion Team August 1, 2013 10:09 AM UTC

Hi Jim,

Thanks for using Syncfusion products.

Query : Edit works fine in a child grid, but fails in a parent grid.

We are sorry for inconvenience caused. We are unable to reproduce the issue. We have prepared a simple sample, video demonstrating the working of the sample and the same can be downloaded from the following link.

Could you please try the above sample and get back to us whether you are able to reproduce the issue? If not, could you please give more information or by reproducing the issue in the above sample so that we could sort out the issue and provide you with solution. The information provided would be of great help in resolving the issue.

Please let us know if you have any concerns.

Regards,

Ajith R

 



Sample_dae324e2.zip


JB Jeremy Branham August 8, 2013 11:51 PM UTC

Thanks for the sample, but I am using a GridModelProperties object, not the GridBuilder.


JB Jeremy Branham August 9, 2013 08:18 PM UTC

I tried the sample and it works, so I tried using the GridBuilder and it failed in my app.
I removed all sync fusion components and web config settings and re-added them through the VS extension. But it still failed.
 
I created a new project using MVC 3 instead of 4 and using .NET 4 instead or 4.5, then imported all my class files and references. It failed again.
 
I am using the same _Layout.cshtml and compared assembly references in the web config.
Nothing is sticking out that would cause this problem.
 
The next step is to add your sample project to my solution and start adding my class files and references until I can break it.
 


JB Jeremy Branham August 13, 2013 12:19 AM UTC

I found the issue…

 

When I remove the Default action overloaded method [HttpPost], I can reproduce the issue.

The javascript exception thrown was no help in discovering this.

I suppose a http debugger may have revealed a clue if I had seen some traffic.

Argh…



AR Ajith R Syncfusion Team August 16, 2013 01:08 PM UTC

Hi,

Thanks for your update.

Could you please let us know your reported issue has been resolved or if not please provide more information regarding the issue so that we could sort out the issue and provide you with solution. The information provided would be of great help in resolving the issue.

Regards,

Ajith R

Loader.
Up arrow icon