Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8063489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:03:28+00:00 2026-06-05T11:03:28+00:00

I have created a custom field in and empty sharepoint project and I have

  • 0

I have created a custom field in and empty sharepoint project and I have overridden the FieldRenderingControl so I can create my own table layout when the item in the list is displayed.

The problem I am having is that the ItemFieldValue in the rendering control class is always null.

How do I get the field value of the field I am trying to display?

This is my Custom Field Class

namespace CustomFieldDefinitions.Fields
{
    public class AttributeField : SPField
    {
        #region Constructors

        /// <summary>
        /// This is a constuctor with two parameters.
        /// </summary>
        /// <param name="fields"></param>
        /// <param name="fieldName"></param>
        public AttributeField(SPFieldCollection fields, string fieldName)
            : base(fields, fieldName)
        {
        }

        /// <summary>
        /// This is a contructor with three parameters.
        /// </summary>
        /// <param name="fields"></param>
        /// <param name="typeName"></param>
        /// <param name="displayName"></param>
        public AttributeField(SPFieldCollection fields, string typeName, string displayName)
            : base(fields, typeName, displayName)
        {
        }

        #endregion

        #region Overridden Properties

        /// <summary>
        /// This ties the control used to support this field with the current implementation of it.
        /// </summary>
        public override BaseFieldControl FieldRenderingControl
        {
            [SharePointPermission(SecurityAction.LinkDemand, ObjectModel = true)]
            get
            {
                BaseFieldControl fieldControl = new AttributeFieldControl();
                fieldControl.FieldName = this.InternalName;
                return fieldControl;
            }
        }


        public override object GetFieldValue(string value)
        {
            return base.GetFieldValue(value);
        }

        #endregion

    }
}

And my FieldRenderingControl Class

namespace CustomFieldDefinitions.FieldControls
{
    public class AttributeFieldControl : BaseFieldControl
    {
        protected Label AttributeValueForDisplay;
        protected TextBox AttributeValueTextbox;

        public override string DisplayTemplateName
        {
            get
            {
                 return "AttributeFieldDisplayControl";
            }
            set
            {
                base.DisplayTemplateName = value;
            }
        }

        protected override string DefaultTemplateName
        {
            get
            {
                 if (this.ControlMode == SPControlMode.Display)
                {
                    return this.DisplayTemplateName;
                }
                else
                {
                    return "AttributeFieldControl";
                }
            }
        }

        protected override void CreateChildControls()
        {
            if (this.Field != null)
            {
                 base.CreateChildControls();

                 this.AttributeValueForDisplay = (Label)TemplateContainer.FindControl("lblAttValue");
                 this.AttributeValueTextbox = (TextBox)TemplateContainer.FindControl("txtAttValue");

                 if (ControlMode == SPControlMode.New || ControlMode == SPControlMode.Edit)
                 {
                     AttributeValueTextbox.Text = Convert.ToString(this.ListItemFieldValue);
                 }
                 else
                 {
                     AttributeValueForDisplay.Text = Convert.ToString(this.ListItemFieldValue);
                 }
            }
        }
    }
}

And Finally the Markup

<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %> 
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" %>
<SharePoint:RenderingTemplate ID="AttributeFieldDisplayControl" runat="server">
    <Template>
        <asp:Label ID="lblAttValue" runat="server" BorderColor="Red"></asp:Label>
    </Template>
</SharePoint:RenderingTemplate>
<SharePoint:RenderingTemplate ID="AttributeFieldControl" runat="server">
    <Template>
        <asp:TextBox ID="txtAttValue" runat="server" BorderColor="Red"></asp:TextBox>
    </Template>
</SharePoint:RenderingTemplate>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T11:03:31+00:00Added an answer on June 5, 2026 at 11:03 am

    Please find enclosed the answer to this question. I am a gigantic moron. When the ReadItem method of my BdcModel was being called I was not setting the ‘AttributeValue’ property of the object that was being passed to the display page.

    So once I added that everything is working just fine. Thank you to anyone that looked at this post. I apologize that I wasted your time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a custom user profile field <?php $basics = get_the_author_meta( 'fbasics', $user->ID
I have created one custom list view item for my application. Suppose for any
I have a created a custom Button field , when the button is on
I have created an application that contains a list field(custom) If a certain condition
I have created a custom field class Seek to draw a fillrectangle. class Seek
I have created my custom field type for listing available users in to Dropdownlist.
I have created a custom field in Opportunities, but I also have to translate
I have created a custom date_Select field using 3 separate select fields: <%= f.select
In Wordpress I have created a custom field 'LatLonPosition' which contains different positions in
I have created custom validation attribute [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.