Dieses Blog durchsuchen

Dienstag, 25. Februar 2014

Sitecore: Field property is required. All field web controls require the field name to be set.

Server Error in '/' Application.

Field property is required. All field web controls require the field name to be set.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Field property is required. All field web controls require the field name to be set.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[InvalidOperationException: Field property is required. All field web controls require the field name to be set.]
   Sitecore.Web.UI.WebControls.FieldControl.DoRender(HtmlTextWriter output) +538
   Sitecore.Web.UI.WebControl.Render(HtmlTextWriter output) +378
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +150
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +249
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +150
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +249
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +150
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +249
   System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer) +15
   System.Web.UI.WebControls.ListView.Render(HtmlTextWriter writer) +18
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +150
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +249
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +150
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +249
   Sitecore.Web.UI.WebControls.Sublayout.DoRender(HtmlTextWriter output) +43
....





SOLUTION:

1. My recommendation is to use the Fieldrender if possible. There are many types supported, even Images.
See the list of supported types here:
http://www.theinsidecorner.com/en/Developers/ContentDisplay/FieldValues/UsingFieldRenderer

2. If you use the sc:Text control, be careful with the Attribute for the Field Name!! They look different and are not equal. Sadly the "Enclosing Tag" or the"CssClass" Attribute are not available in important SC Controls. That makes life harder and need to set via code behind or with just HTML.   

Use Attribute "Field" for the sc:Text Control to set the Fieldname from the Sitecore Backend!
<sc:Text ID="scText" Field="Description" runat="server" />