Prev: What garbage collector collects int datatype
Next: Strange integer values in ASP.NET application
From: SAL on 2 Sep 2010 14:37 Hello, I'm needing some help with JQuery as I'm brand new to this. I have googled and googled and the following is the best examples I can come up with. I have tried using JSON's stringify but an error occurs running out of memory. I have a gridview with a template field. In the template field there is a checkbox. I have declared onclick="chkHelp(this);" in the checkbox. In the javascript chkHelp, I call the following javascript function: function chkAdd(objRef) { // objRef is an ASP.NET checkbox who's parent is a gridviewrow who's parent is a gridview. These // resolve correctly. var gvr = objRef.parentNode.parentNode; var gv = gvr.parentNode; CallPageMethod("DoCheckbox", success, fail, "obj", objRef, "gv", gv, "gvrow", gvr); } In the CallPageMethod javascript function, I do the following: function CallPageMethod(methodName, onSuccess, onFail) { var args = ''; var l = arguments.length; if (l > 3) { for (var i = 3; i < l - 1; i += 2) { if (args.length != 0) args += ','; args += '"' + arguments[i] + '":"' + arguments[i + 1] + '"'; } } var loc = window.location.href; loc = (loc.substr(loc.length - 1, 1) == "/") ? loc + "OwnerLinkPossEditor.aspx" : loc; $.ajax({ type: "POST", url: loc + "/" + methodName, data: "{" + args + "}", //"{" + args + "}", contentType: "application/json; charset=utf-8", dataType: "json", success: onSuccess, fail: onFail }); } The page method is getting called correctly but the objects that get passed are strings and I can't convert them to the correct object types. I have tried removing the quotes around the objects but then the page method does even get called. Can somebody help me with how to pass the objects correctly to the page method? Needing help ASAP as I've been working on this for a bit now. Thanks SAL
|
Pages: 1 Prev: What garbage collector collects int datatype Next: Strange integer values in ASP.NET application |