Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > JQuery help

Reply
Thread Tools

JQuery help

 
 
SAL
Guest
Posts: n/a
 
      09-02-2010
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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Microsoft expanding it use of jQuery & involvement with jQuery lorlarz Javascript 6 03-25-2010 10:14 PM
JQuery Integration Help Alex Maghen ASP .Net 2 01-05-2009 06:58 AM
jQuery Query about comparing jQuery references Aaron Gray Javascript 20 07-27-2008 01:53 PM
Need help extending AjaxFileUpload Plugin with JQuery Big Moxy Javascript 1 12-22-2007 12:42 AM
jQuery, Prototype/Script.aculo.us, YUI/Ext, Dojo, MochiKit, Zimbra, etc....help :] hedgehog Javascript 1 04-06-2007 04:01 PM



Advertisments