Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Cms_Application not set on Ajax call
brucek
#1 Posted : Thursday, July 29, 2010 9:11:10 PM(UTC)
Rank: Newbie
Groups: Registered

Joined: 7/8/2010(UTC)
Posts: 6
Location: Melbourne, Australia
Hi,
I am trying to use CmsContext.ContentService.GetContentsByFolder in a ActionResult in a controller on a Ajax callback. The GetContentsByFolder call fails on Ajax call but succeeds on a normal view request by a link.

The only difference I can see on viewing the objects on debug is that the CMSContext property Cms_Application is null on the Ajax call and set on the link request.

Is this a bug?
How can I get the content data on a Ajax call?

Regards
Bruce
Baseless
#2 Posted : Thursday, July 29, 2010 9:27:21 PM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 6/10/2010(UTC)
Posts: 135
Location: Sweden
You can get the CmsContext by calling HttpContext.GetCmsContext() or alternatively pass it by using static / singleton.
Though i dont think this is a pretty solution though in some cases its necessary (unless someone has a better solution).
For example when using it in a way that an insatnce isnt created.

Though when its possible just pass this.CmsContext from the controller.
brucek
#3 Posted : Thursday, July 29, 2010 10:33:20 PM(UTC)
Rank: Newbie
Groups: Registered

Joined: 7/8/2010(UTC)
Posts: 6
Location: Melbourne, Australia
I can get the CmsContext, but on the ajax call the GetContent fails and exceptions a null. On a normal page request from a link the GetContent succeeds and returns the data.

The only difference I can see between the 2 is that the CmsContext has the property Cms_Application which is null in the ajax call and set in the normal link request.

I am stepping through the code to find the problem.
Baseless
#4 Posted : Saturday, July 31, 2010 5:48:16 AM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 6/10/2010(UTC)
Posts: 135
Location: Sweden
I have done some module ajax calls but only for non kooboo CmsContext stuff, havent tried this before.
Though no matter how you access the controller action you should get intellisense.
I suppose your controller is inheriting ModuleController(or any baseclass that inturn has that inheritance)?
I did a quick test on an old module code and i get intellisense for Cms_Application though i ran into null issues as well. Think it would be best to get a dev answer for this or perhaps someone with more kooboo experiance than i.
GazNewt
#5 Posted : Monday, August 02, 2010 6:52:59 AM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 2/2/2010(UTC)
Posts: 122
Location: England
Hi brucek,

This works for me I can only guess that perhaps your url is wrong. Does your url contain the full path to the module for example :

/KooBoo_2_1_1_0/Site/c-ShootingSeeds/Contact/?ModuleUrl=mod_3060/Default/AjaxTest

/Contact/ is a page that contains the module as a component.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF 1.9.5.5 | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.083 seconds.