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

Forums / Bugs & Issues / Custom Meta Data not displaying

Custom Meta Data not displaying

3 posts, 0 answered
  1. Joe
    Joe avatar
    64 posts
    Registered:
    05 Jul 2012
    10 Apr 2008
    Link to this post
    • I have added a new meta data tag to the event module.  I updated the

    • \Sitefinity\Admin\ControlTemplates\Events\ControlPanelInsert.ascx
    • \Sitefinity\Admin\ControlTemplates\Events\ControlPanelEdit.ascx
    • \Sitefinity\ControlTemplates\Events\ContentViewSingleItem.ascx

    templates to add the field.  The issue lies within displaying the custom meta data field on the event page.  The data exists in the database, populates on the insert and update form but will not display on the event page.

    Here are the code snippets.

    ControlPanelInsert.ascx
    <fieldset class="set"
      <div class="setIn"
       <asp:Label ID="lblClickToAttendId" runat="server" Text='<%$Resources:ClickToAttendId %>' AssociatedControlID="ClickToAttendId"></asp:Label> 
       <asp:TextBox ID="ClickToAttendId" runat="server"></asp:TextBox> 
      </div> 
    </fieldset> 

    ControlPanelEdit.ascx
    <fieldset class="set"
      <div class="setIn"
        <asp:Label ID="lblClickToAttendId" runat="server" Text='<%$Resources:ClickToAttendId %>' AssociatedControlID="ClickToAttendId"></asp:Label> 
        <asp:TextBox ID="ClickToAttendId" runat="server"></asp:TextBox> 
      </div> 
    </fieldset> 


    • ContentViewSingleItem.ascx
    • <p>Register <asp:Literal ID="ClickToAttendId" runat="server" Text="<a href='http://www.clicktoattend.com/invitation.aspx?code={0}'>here</a>"></asp:Literal>"></p
    web.config
    <add key="Events.ClickToAttendId" valueType="Integer" visible="True" searchable="False" sortable="True" defaultValue=""/> 

    I have tried to just display the ClickToAttendId in an asp:Literal tag but nothing displays.  The ideal goal would be to display a hyperlink as formatted above.

    Thanks!
  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    12 Apr 2008
    Link to this post
    Hello Joseph,
    Using Integer for valueType in web.config would not work, because the Text property accepts String, and if you would try to retrieve the value of ClickToAttendId with this expression :
    Text="<a href='http://www.clicktoattend.com/invitation.aspx?code={0}'>here</a>"
    the value which should be replaced in {0} couldn't be automatically converted from Integer to String.
    That's why I suggest you to use ShortText for valueType in web.config :
    <add key="Events.ClickToAttendId"  
         valueType="ShortText"  
         visible="True"  
         searchable="False"  
         sortable="True"  
         defaultValue=""/>  

    This way the {0} will be replaced successfully with the ClickToAttendId value .I have attached some screenshots for you.
    If you try to change valueType directly, you would probably get an error, because the ClickToAttendId will already exists in the database with other valueType. That's why it would be good if you create new metafield, with unique name and use it instead of ClickToAttendId.

    Let us know if there is anything else we could assist you with.

    Greetings,
    Georgi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Joe
    Joe avatar
    64 posts
    Registered:
    05 Jul 2012
    12 Apr 2008
    Link to this post
    I thank you for your reply.  After 2 days of playing around with it I figured it out.  I ended up going with the same solution that you presenter with a few modifications.
Register for webinar
3 posts, 0 answered