Hi Tanvi,
I believe this proprty is to display like - (c) 2019. You can add a placeholder {0} from the CMS in the field value. Replace that placeholder with current year in Front end.
E.g
So input would text for FooterCopyRightText will like '© {0}'
string.Fromat(FooterCopyRightText.ToHtmlString(), DateTime.Today.Year); => (c) 2019.
Dipak
When you will set the value from the CMS set it with placeholder i.e. '{0}'
In your case it would be like '@Copyright {0}', so that {0} is get replaced with current year on the front end or at controller.
string.Fromat(FooterCopyRightText.ToHtmlString(), DateTime.Today.Year);
O/p => @Copyright 2020
Also think about type of porpety, whether you want XHTMLString or string?
Hi,
I have a property
public virtual XhtmlString FooterCopyRightText { get; set; }
Through CMS, editor will add the text with year in this. While rendering this property on View, I want to display the current year on it dynamically.
How to do it?