Pages

Tuesday, June 23, 2009

Postback issues with Sitecore 6 - typesThatShouldNotBeExpanded

I've run into this a couple of times now. An ASP.NET control, say the FormView, posts back to the server to change the page contents, say transitioning from the view to edit mode. The page loads, but some of the state or the postback event get lost along the way.

If the same control/code works just fine outside of Sitecore start looking for a solution with the rendering/typesThatShouldNotBeExpanded element in the web.config.

According to ListView and DataPager under Sitecore context"

As Sitecore runs [the] "layout pipeline" during [the] page rendering process, some of the complex ASP.NET controls may fail due to changes in the control tree. Adding type to the mentioned list allows affected ASP.NET controls to work the way they were initially designed.
<!-- RENDERING -->
  <rendering>
      <typesThatShouldNotBeExpanded>
        <type>System.Web.UI.WebControls.DropDownList</type>
        <type>System.Web.UI.WebControls.GridView</type>
        <type>System.Web.UI.WebControls.Repeater</type>
        <type>System.Web.UI.WebControls.DataList</type>
        <type>System.Web.UI.WebControls.FormView</type>
        <!-- Fix issue with the LoginStatus logout link not working when nested in a LoginView -- >
        <type>System.Web.UI.WebControls.LoginView</type>
      </typesThatShouldNotBeExpanded>
  </rendering>

See also:

No comments:

Post a Comment