+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Adding custom field to news module

Adding custom field to news module

5 posts, 0 answered
  1. Dmitriy Skudnov
    Dmitriy Skudnov avatar
    4 posts
    Registered:
    01 Sep 2009
    08 Oct 2009
    Link to this post
    Hi.

    I want to add custom field - "shortcontent" to news module. I was following all instructions that i could find, have add
     <metaFields> 
           ... 
            <add key="News.ShortContent" valueType="LongText" visible="True" searchable="False" sortable="False" defaultValue=""/> 
            ... 
     </metaFields> 
     code into web.config,
    add generic templates to admin part and to user part, but this filed is not saving for me.
    I can see that In table sf_gcmetadata exist a row with  KeyValue=ShortContent but LongText value is just empty (not null). When i am changing LongText manually in Db, i can see it on user part, but not in admin.
    On admin part i have tried
     <asp:TextBox ID="ShortContent" runat="server" Text=""></asp:TextBox> 
    and
    <sf:ContentMetaFields ID="editMetaFields" runat="server"
                <ItemTemplate> 
                    <asp:TextBox ID="ShortContent" runat="server" Text=""></asp:TextBox> 
                </ItemTemplate> 
            </sf:ContentMetaFields> 
    and
    <sf:ContentMetaFields ID="editMetaFields" runat="server"
                    <asp:TextBox ID="ShortContent" runat="server" Text=""></asp:TextBox> 
            </sf:ContentMetaFields> 
    , but any of them didn't work for me.

    Could you please help me, what i am doing wrong?

    BR, Dmitriy
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    09 Oct 2009
    Link to this post
    Hello Dmitriy Skudnov,

    Please try removing Text property from the TextBox declaration. Each time you are setting empty string "". Let us know how it goes.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Dmitriy Skudnov
    Dmitriy Skudnov avatar
    4 posts
    Registered:
    01 Sep 2009
    09 Oct 2009
    Link to this post
    Hi Ivan.

    Thank you for your reply.
    I have remove Text property, but it still not working. And in any case i think this is not a reasone, because Text property is using also for Title like
    <asp:TextBox ID="Title" Text="<%$Resources:TitleInput %>" runat="server" MaxLength="250" ValidationGroup="InsertNews"></asp:TextBox> 

    Also i have tried to change type of the custom field to "ShortText" - this didn't help also.
    I am using Sitefinity_3_7_1990_community_BlankProject with Mysql 5.0.45

    BR, Dmitriy.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    09 Oct 2009
    Link to this post
    Hi Dmitriy Skudnov,

    1. There is not ContentMetaFields in NewsItemEdit or NewsItemNew templates of Sitefinity 3.7 1990.

    Your insert and edit  templates should look like as shown  below:

    ContentMetaFields - ItemTemplate

    <sf:ContentMetaFields ID="MetaFields" runat="server">
           <ItemTemplate>
               <h3><asp:Literal ID="Literal7" runat="server" Text="<%$Resources:Category %>"></asp:Literal></h3>
                <fieldset class="set">
                   <ol class="setIn">
                       <li class="catSel clearfix">
                               <asp:Label ID="Label8" AssociatedControlID="Category" runat="server">
                                   <asp:Literal ID="Literal1" runat="server" Text="<%$Resources:Category %>"></asp:Literal>
                               <em id="Em1" runat="server"></em></asp:Label>
                               <sf:ContentCategoriesField ID="Category" runat="server" />
                        </li>                                                
                       </ol>
                   </fieldset>
                   <div class="bottom"><div><!-- --></div></div>
                   <h3>
                       <asp:Literal ID="Literal3" runat="server" Text="<%$Resources:Tags %>"></asp:Literal></h3>
                   <fieldset class="set">
                       <ol class="setIn">
                           <li class="tags">
                               <sf:ContentTagEditor ID="tagsControl" runat="server" />
                           </li>
                       </ol>
                   </fieldset>
                   <div class="bottom">
                       <div>
                           <!-- -->
                       </div>
                   </div>
                   <h3><asp:Literal ID="Literal8" runat="server" Text="<%$Resources:AdditionalInfo %>"></asp:Literal></h3>
                   <fieldset class="set">
                     <ol class="setIn">
                     <li>
                       <asp:Label ID="Label9" AssociatedControlID="ShortContent" runat="server"><asp:Literal ID="Literal19" runat="server" Text="ShortContent"></asp:Literal> <em id="Em2" runat="server"></em></asp:Label>
                        <asp:TextBox ID="ShortContent" Text="" runat="server" MaxLength="250"></asp:TextBox>
                       </li>
                       <li>
                           <asp:Label ID="Label4" AssociatedControlID="Summary" runat="server"><asp:Literal ID="Literal6" runat="server" Text="<%$Resources:Summary %>"></asp:Literal> <em id="SummaryLabel" runat="server"></em></asp:Label>
                           <asp:TextBox ID="Summary" TextMode="MultiLine" Text="" runat="server"></asp:TextBox>
                           <p class="example"><asp:Literal ID="Literal9" runat="server" Text="<%$Resources:SummaryNote %>"></asp:Literal></p>
                       </li>
                        <li>
                           <asp:Label ID="Label3" AssociatedControlID="Author" runat="server"><asp:Literal ID="Literal10" runat="server" Text="<%$Resources:Author %>"></asp:Literal> <em id="AuthorLabel" runat="server"></em></asp:Label>
                           <asp:TextBox ID="Author" Text="<%$Resources:AuthorInput %>" runat="server" MaxLength="250"></asp:TextBox>
                           <p class="example"><asp:Literal ID="Literal11" runat="server" Text="<%$Resources:AuthorNote %>"></asp:Literal></p>
                       </li>
                        <li>
                           <asp:Label ID="Label5" AssociatedControlID="Source" runat="server"><asp:Literal ID="Literal12" runat="server" Text="<%$Resources:Source %>"></asp:Literal> <em id="SourceLabel" runat="server"></em></asp:Label>
                           <asp:TextBox ID="Source" Text="" runat="server" MaxLength="250"></asp:TextBox>
                           <p class="example"><asp:Literal ID="Literal13" runat="server" Text="<%$Resources:SourceNote %>"></asp:Literal></p>
                       </li>
                        
                       <li class="selector">
                           <asp:Label ID="Label2" AssociatedControlID="Thumbnail" runat="server"><asp:Literal ID="Literal14" runat="server" Text="<%$Resources:Thumbnail %>"></asp:Literal> <em id="ThumbnailLabel" runat="server"></em></asp:Label>
                           <asp:TextBox ID="Thumbnail" Text="" runat="server" MaxLength="250"></asp:TextBox>
                           <sfLib:ButtonSelector WindowNavigateUrl="~/Sitefinity/UserControls/Dialogs/ImageEditorDialog.aspx" ItemTemplatePath="~/Sitefinity/Admin/ControlTemplates/News/Dialogs/ButtonSelector.ascx" AssociatedControls="Thumbnail" runat="server" cssclass="pickerWrapper" ButtonText="<%$Resources:Select%>" />
                           <p class="example">
                               <asp:Literal ID="Literal15" runat="server" Text="<%$Resources:ThumbnailNote %>"></asp:Literal>
                           </p>
                       </li>
                     </ol
                   </fieldset>
                   <div class="bottom"><div><!-- --></div></div>
                    
                    
                    
                    
                   <h3><asp:Literal ID="Literal16" runat="server" Text="<%$Resources:Schedule %>"></asp:Literal></h3>
                   <fieldset class="set dates">
                       <ol class="setIn">                              
                        
                        <li>
                           <asp:Label ID="Label6" AssociatedControlID="Publication_Date" runat="server"><asp:Literal ID="Literal17" runat="server" Text="<%$Resources:PublicationDate %>"></asp:Literal> <em id="Publication_DateLabel" runat="server"></em></asp:Label>                                   
                           <telerik:RadDateTimePicker ID="Publication_Date" runat="server"></telerik:RadDateTimePicker>
                       </li>
                       <li>
                           <asp:Label ID="Label7" AssociatedControlID="Expiration_Date" runat="server"><asp:Literal ID="Literal18" runat="server" Text="<%$Resources:ExpirationDate %>"></asp:Literal> <em id="Expiration_DateLabel" runat="server"></em></asp:Label>                                   
                           <telerik:RadDateTimePicker ID="Expiration_Date" runat="server"></telerik:RadDateTimePicker>
                       </li>                                
                   </ol>
               </fieldset>
           </ItemTemplate>
       </sf:ContentMetaFields>

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Dmitriy Skudnov
    Dmitriy Skudnov avatar
    4 posts
    Registered:
    01 Sep 2009
    09 Oct 2009
    Link to this post
    Hi Ivan. Thank you a lot for your help.
    It is working perfect.

    BR, Dmitriy
Register for webinar
5 posts, 0 answered