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

Forums / Developing with Sitefinity / Removing empty fields on events

Removing empty fields on events

12 posts, 0 answered
  1. Stephen
    Stephen avatar
    9 posts
    Registered:
    04 Jan 2008
    31 Jul 2008
    Link to this post
    Hello
    Can I format the event details to remove (not show) fields for which no values are supplied.
    Fields such as State, Web, email etc cause events to display unprofessionally when left blank.
    Thanks
  2. Joe
    Joe avatar
    138 posts
    Registered:
    24 Sep 2012
    04 Aug 2008
    Link to this post
    Hi Stephen,

    Thanks for contacting us.

    Sitefinity's default behavior is to show an empty space when there are no field values. What you're actually seeing are the words "Street", "City", "Zip", and "Country" just typed on an .ascx page and these can easily be commented out. For these words to removed from all the Event Module templates, you will need to open these files:
    • ~/Sitefinity/ControlTemplates/Events/Modes/AllPostsListMaster.ascx
    • ~/Sitefinity/ControlTemplates/Events/Modes/ExpandableListMaster.ascx
    • ~/Sitefinity/ControlTemplates/Events/Modes//ListPageMaster.ascx
    • ~/Sitefinity/ControlTemplates/Events/Modes/ListPageDetail.ascx
    I hope that I have given you clear instructions on implementing the desired functionality. Feel free to contact us if you need further assistance.

    All the best,
    Joe

    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Dave
    Dave avatar
    14 posts
    Registered:
    04 Feb 2009
    18 Mar 2009
    Link to this post
    Sometimes there will be values entered, so how do you allow for showing the text when there is a value and not showing if there is no value?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    18 Mar 2009
    Link to this post
    Hi Dave,

    As I see the post is old. Currently the solution is different.

    You should edit the following templates

    ~/Sitefinity/ControlTemplates/Events/Modes/ListPageDetail.ascx

    Here you should remove <asp:PlaceHolder id="plhWhere" runat="server"> and the text before Literal controls.
    Then you should edit - ~/Sitefinity/Admin/ControlTemplates/Events/Design/EventsViewControlDesigner.ascx

    1. remove TextSetings TargetID="plhWhere"  and add new TextSettings -. Example CustomStree, CustomCountry and so on.
    2. Set FormatType="String" and AllowFormatSetting="False" for each TextSettings
     
    Thus you are changing EventsView control designer. Under Setting section you will see that new properties are available. Then set the string format. - {0}. If there is value it will be dispayed otherwise - nothing.
    If you are running 3.6 you should map the templates. I hope this helps.

    Best wishes,
    Ivan Dimitrov
    the Telerik team


    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. Dave
    Dave avatar
    14 posts
    Registered:
    04 Feb 2009
    18 Mar 2009
    Link to this post
    What are the TargetID's for Event Street, City, State, Country.
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    19 Mar 2009
    Link to this post
    Hello Dave,

    "Then you should edit - ~/Sitefinity/Admin/ControlTemplates/Events/Design/EventsViewControlDesigner.ascx"

    There is one TargetID that use the ID of the place holder.

    Kind regards,
    Ivan Dimitrov
    the Telerik team


    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  7. Dave
    Dave avatar
    14 posts
    Registered:
    04 Feb 2009
    19 Mar 2009
    Link to this post
    Doesn't each seperate location field have its own TargetID?  I can't just use plhWhere as my TargetID for TextSettingCustomStreet and plhWhere as my TargetID for TextSettingCustomCity and so on.
  8. Dave
    Dave avatar
    14 posts
    Registered:
    04 Feb 2009
    19 Mar 2009
    Link to this post
    Does the TargetID used on the ControlDesigner.ascx page, just have to match the ID used on the ListPageDetail.ascx.  Is that correct?  There are no set TargetID's?
  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    19 Mar 2009
    Link to this post
    Hi Dave,

    Here are code samples that cover the steps I posted in my previous posts.

    1.Removing where holder

    <asp:PlaceHolder id="plhWhere" runat="server"></asp:PlaceHolder>  

    2. Removing text properties from literals

    <address id="Location" runat="server" class="sf_eventLocation">  
                <asp:Literal ID="Street" runat="server" ></asp:Literal><br />  
                <asp:Literal ID="City" runat="server" ></asp:Literal><br />  
                <asp:Literal ID="State" runat="server" ></asp:Literal><br />  
                <asp:Literal ID="Country" runat="server"></asp:Literal><br />  
    </address> 

    3. Open ~/Sitefinity/Admin/ControlTemplates/Events/Design/EventsViewControlDesigner.ascx

    4. Remove the TextSetting setting which was controlling the plhWhere element in the template (the one which has TargetID="plhWhere"

    5 .Add the TextSetting  for PresentationModeSettings control using ID="ModesSettings1"  in

    <sfDesignSettings:TextSetting ID="TextSetting12"  
        TargetID="Street"   
        SettingTitle="Location Custom Street"   
        AllowLabelSetting="False"   
        AllowFormatSetting="True"  
        AllowVisibilitySetting="True"  
        TargetVisibleByDefault="True">  
        </sfDesignSettings:TextSetting>   
    <sfDesignSettings:TextSetting ID="TextSetting16"  
        TargetID="City"   
        SettingTitle="Location Custom City"   
        AllowLabelSetting="False"   
        AllowFormatSetting="True"  
        FormatType="String"  
        AllowVisibilitySetting="True"  
        TargetVisibleByDefault="True">  
        </sfDesignSettings:TextSetting>   
    <sfDesignSettings:TextSetting ID="TextSetting27"  
        TargetID="Location Custom State"   
        AllowLabelSetting="False"   
        AllowFormatSetting="True"  
        FormatType="String"  
        AllowVisibilitySetting="True"  
        TargetVisibleByDefault="True">  
        </sfDesignSettings:TextSetting>  
    <sfDesignSettings:TextSetting ID="TextSetting38"  
            TargetID="Country"   
        SettingTitle="Location Custom Country"   
        AllowLabelSetting="False"   
        AllowFormatSetting="True"  
        FormatType="String"  
        AllowVisibilitySetting="True"  
        TargetVisibleByDefault="True">  
        </sfDesignSettings:TextSetting>  

    Finishing notes - open EventsView designer - you will see that you have new settings - the one you have added in designer.
    - For "Country", "State", "Street" and "City" settings, click on "Set format" next to Country. Make the format look like this > Country : {0}. Do this for "State", "Street" and "City"


    Regards,
    Ivan Dimitrov
    the Telerik team


    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  10. Dave
    Dave avatar
    14 posts
    Registered:
    04 Feb 2009
    19 Mar 2009
    Link to this post
    Thank you, this solved my problem.  One thing to note for others making changes to the EventsViewControlDesinger.ascx file and possibly other ControlTemplates files on the admin side, is that for almost every change I made to the .ascx file I had to delete my control from my page and drag a new one back on for the changes I made to the control to be functional.  For example, I was adding settings for custom fields like Street, City, etc. on the EventView control.  That is done on the admin side.  When I would go back to my EventView control on the front-end, the settings for the custom controls would be there to adjust.  So everything is good to this point.  However any adjustments I made to these settings would not save.  This is where I spent alot of time wondering what I did wrong.  Just wanted to save others some time if, they get stuck like me.  Thanks again for your help and quick responses.
  11. Brad
    Brad avatar
    3 posts
    Registered:
    29 Sep 2010
    09 Feb 2011
    Link to this post
    Is there a different way of doing this in 3.7?

    I can't seem to find the following file:
    ~/Sitefinity/Admin/ControlTemplates/Events/Design/EventsViewControlDesigner.ascx

    Thanks,
    Brad
  12. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    09 Feb 2011
    Link to this post
    Hello Brad,

    Please make sure that you have the external templates

    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
12 posts, 0 answered