2
votes

I just click submit button and got an exception. Unable to debug, because this happens before the submit event handler work. I tried to clear sitecore caches, browser caches and cookies... nothing helps.

here the stack trace.

[NullReferenceException: Object reference not set to an instance of an object.] Sitecore.Web.UI.WebControl.GetCacheKey() +242 Sitecore.Web.UI.WebControl.Render(HtmlTextWriter output) +61 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19 System.Web.UI.HtmlControls.HtmlHead.RenderChildren(HtmlTextWriter writer) +17 System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19 System.Web.UI.Page.Render(HtmlTextWriter writer) +29 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266

3
What version? What do you mean by "submit button"? What page exactly are we talking about? Is this some Sitecore tool or a content page you've created? Have you tried an iisreset?!Bryan

3 Answers

1
votes

Sitecore Version 6 The page - a content page with sublayout, represented by my own UserControl which contains a submit button. Yes, I've tried iisreset, does not help.

0
votes

EDIT: I answered my own question eventually!

I found a solution that worked for me on this blog.

It seems you need to make sure that your App_Browser folder in intact and well. Mine had gone missing when I cloned the site files. Doh!

Speciffically, make sure you have an App_Browsers\Form.browser file in the root of your site, which contains, at a minimum,

<adapter controlType="System.Web.UI.HtmlControls.HtmlForm" adapterType="Sitecore.Web.FormAdapter, Sitecore.Kernel" />

Hope this helps!

My original "Answer Question"

Anyone else having this problem? Or did this ever get resolved?

I have the same problem.

I have a few pages with my own custom sublayouts. One one page is an <asp:Login> and another just has an <asp:Button>. As soon as the "Login" button is clicked, or the button on the other page is clicked, and before any code-behind is executed, I get a null reference exception exactly as in the question above.

The exact same sub layout works on a different clone of the website (we have just finished copying and re-purposing the site) - so this should be some kind of config problem?

0
votes

I just chased down a problem on my development environment and eventually found that App_Browsers\Form.browser (and XamlPage.browser for that matter) all of a sudden had gone missing....!?

Anyone have a clue as to what can make these go away? :-)