How to make Audience field of custom page layout mandatory using code in sharepoint 2010. RRS feed

  • Question

  • I have a custom page layout, in which I am using a Audience field as below.

    <tr><td><OfficeWebControls:SPFieldTargetToControl ID="Audience" runat="server" FieldName="Audience" /></td></tr>

    Now I want to make this field as required, means while creating the page Audience field should not be left empty.

    I tried making this site column mandatory by out of box method but it did not happened. Could someone can explain how I can achive this by code. How I can get this field in code behind of page layout.

    Early help will be appreciated.



    Monday, May 26, 2014 7:22 AM