Error - Publishing Page Layout Field Control

Jul 10, 2009 at 9:13 PM

Hello,

 

First let me say, what a great tool! I can see this solving alot of my hangups with WCM. Yes, I am using MOSS to create Public Facing Sites. Ok, heres my error;

 

[NullReferenceException: Object reference not set to an instance of an object.]
   Bronyx.SharePoint.FieldControls.Util.GetAvailableValues(FilteredLookupField f, HttpContext ctx) +90
   Bronyx.SharePoint.FieldControls.FilteredLookupFieldControl.Initialize() +69
   Bronyx.SharePoint.FieldControls.FilteredLookupFieldControl.OnInit(EventArgs e) +167
   System.Web.UI.Control.InitRecursive(Control namingContainer) +321
   System.Web.UI.Control.InitRecursive(Control namingContainer) +198
   System.Web.UI.Control.InitRecursive(Control namingContainer) +198
   System.Web.UI.Control.InitRecursive(Control namingContainer) +198
   System.Web.UI.Control.InitRecursive(Control namingContainer) +198
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +834

 

Ok, I recieved this is the error after the following steps;

  1. installing the solution.
  2. creating a couple fields that lookup the Titles in the Pages Library and filtered by Content Type.
  3. placed them both in a layout page and registered the tag prefix.
  4. created a new page using the layout above.
  5. ERROR occurs.

Can anyone shed any light on this? I am terrible at hunting down code issues and I really need this to work in a publishing site senario.

Thanks.

Nov 4, 2009 at 1:59 PM

Hi,

the exception is thrown in Util.GetAvailableValues

I don't know why, but the site context is retrieved by SPControl.GetContextSite(ctx) - ctx is the current httpcontext.

Using the Current SPContext instead solves the problem, i.e.

SPSite s = SPContext.Current.Site instead of SPSite s = SPControl.GetContextSite(ctx)

Remember that the current site context should not be disposed!

 

Regards,

Tarjei Lægreid