Closed GoogleCodeExporter closed 9 years ago
I don't know much about Aspx.
Why does it use data.d? Are there other additional properties in data except
for 'd'?
Your propsal looks very simple, but I am a little bit hesitant, since there are
some other frameworks out there.
If you look at 'Loading custom formats' in the docs, do you think that would
solve your problem?
Maybe something like this could work:
onLazyRead: function(node){
$.ajax({
url: […],
success: function(data, textStatus){
if(data.status == "ok"){
node.setLazyNodeStatus(DTNodeStatus_Ok);
node.addChild(data.d);
}else{
// Server returned an error condition: set node status accordingly
node.setLazyNodeStatus(DTNodeStatus_Error, {
tooltip: data.faultDetails,
info: data.faultString
});
}
}
Original comment by moo...@wwwendt.de
on 29 May 2011 at 5:57
data.d was introduced with ASP.NET 3.5.
This posting
http://encosia.com/never-worry-about-asp-net-ajaxs-d-again/
shows how the feature could be implemented (using data.hasOwnProperty("d")).
Original comment by moo...@wwwendt.de
on 31 May 2011 at 5:36
"d" is a property wrapper for data returned from a Ajax call to ASPX web
page's WebMethod in .Net Framework 3.5. It is the only property exposed.
Here is a clearer explaination for the "d" property:
http://encosia.com/a-breaking-change-between-versions-of-aspnet-ajax/#comment-34
045
I did read the doc on the onLazyRead. Doesn't it work for individual node? I
was looking for loading the whole tree at once.
Phi
Original comment by nguyenph...@gmail.com
on 2 Jun 2011 at 1:57
Phi,
I checked in yout change. Could you pleas test the version from the trunk?
Thanks
Original comment by moo...@wwwendt.de
on 5 Jun 2011 at 5:11
Release 1.1.2 is rather a feature release 1.2.0
Original comment by moo...@wwwendt.de
on 6 Jun 2011 at 5:34
Original comment by moo...@wwwendt.de
on 3 Jul 2011 at 12:49
Original comment by moo...@wwwendt.de
on 16 Aug 2011 at 7:35
Hi Martin, You asked that I update this issue with the problems I encountered.
My environment is ASP.NET/VB 4.0 under IIS. I set up PageMethods that are
called from your dynaTree which were failing with "Invalid Type" while trying
to retrieve tree nodes.
I ended up modifying your source where around line 1730 where it states:
else if (data && data.hasOwnProperty("d")) {
data = data.d;
}
to
else if (data && data.hasOwnProperty("d")) {
data = $.parseJSON(data.d); // was data = data.d;
}
I have done a bit of research since then to understand why. What I found is
that our PageMethods (web services) seem to return in data.d is a string and
not an object. data is an object but data.d is a string which needs to be
objectified so I added the $.parseJSON call to do that.
I'm not yet sure why the response in data.d is a string at this point but may
come down to some asp.net configuration settings, however this case can
obviously occur and should be handled.
I have updated the your code since then to:
else if (data && data.hasOwnProperty("d")) {
data = (typeof data.d) == 'string' ? $.parseJSON(data.d) : response.d;
}
so that it will only ojbjectify it if needed as I hope to figure out how to get
the service to send proper json in data.d somehow.
Btw, microsoft wraps it's returned json in data.d in an effort to prevent
cross-site-scripting attacks. That's all I know about that.
Hope this helps!
Joel
Original comment by AzJ...@gmail.com
on 26 Nov 2011 at 8:07
Thank you Joel, for tracking that down!
I apply your patch for the next release :)
Original comment by moo...@wwwendt.de
on 27 Nov 2011 at 3:34
It looks to me like this should read:
else if (data && data.hasOwnProperty("d")) {
data = (typeof data.d) == 'string' ? $.parseJSON(data.d) : data.d;
}
Change "response.d" to "data.d".
I was having trouble with this and made the change locally. My ASP.NET
WebMethod is now consumed successfully.
Grant
Original comment by grant.mc...@gmail.com
on 24 Feb 2012 at 10:14
This issue was closed by revision r595.
Original comment by moo...@wwwendt.de
on 25 Feb 2012 at 2:06
considered verified
Original comment by moo...@wwwendt.de
on 17 Jul 2012 at 4:16
Original comment by moo...@wwwendt.de
on 17 Jul 2012 at 4:19
Original issue reported on code.google.com by
nguyenph...@gmail.com
on 27 May 2011 at 7:03