DefaultValue annotations doesn't used for localization.

5 posts, 0 answers
  1. Dzianis
    Dzianis avatar
    3 posts
    Member since:
    Aug 2015

    Posted 28 Aug 2015 Link to this post

    Hello. Could you help me, please?

    I don't see DefaultValue annotations for elements of interface.

    As example I see "DatePopupButtonToolTip" instead of the annotation [DefaultValue("Open the calendar popup.")]

    public class DateTimePicker : RadDateTimePicker
    {
        private DateTimePicker.BDDatePickingCalendar _calendar;
        private DateTimePicker.BDRadDateInput _dateInput;
     
        public override RadCalendar Calendar
        {
            get
            {
                if (_calendar == null)
                {
                    _calendar = new DateTimePicker.BDDatePickingCalendar();
                }
                return _calendar;
            }
        }
     
        public override RadDateInput DateInput
        {
            get
            {
                if (_dateInput == null)
                {
                    _dateInput = new DateTimePicker.BDRadDateInput();
                }
                return _dateInput;
            }
        }
     
        public override DateTime? SelectedDate
        {
            get
            {
                return DateInput.SelectedDate;
            }
            set
            {
                base.SelectedDate = value;
                DateInput.SelectedDate = value;
            }
        }
     
        private class BDRadDateInput : RadDateInput
        {
            private string GetClientControlType()
            {
                Attribute clientScriptResource = TypeDescriptor.GetAttributes(this)[typeof(ClientScriptResourceAttribute)];
                return ((ClientScriptResourceAttribute)clientScriptResource).ComponentType;
            }
     
            protected override IEnumerable<ScriptDescriptor> GetScriptDescriptors()
            {
                var descriptor = new DateTimePicker.BDControlScriptDescriptor(GetClientControlType(), ClientID);
                ((IControl)this).DescribeComponent(descriptor);
                return new List<ScriptDescriptor>(new ScriptDescriptor[] { descriptor });
            }
        }
     
        private class BDDatePickingCalendar : DatePickingCalendar
        {
            private string GetClientControlType()
            {
                Attribute clientScriptResource = TypeDescriptor.GetAttributes(this)[typeof(ClientScriptResourceAttribute)];
                return ((ClientScriptResourceAttribute)clientScriptResource).ComponentType;
            }
     
            protected override IEnumerable<ScriptDescriptor> GetScriptDescriptors()
            {
                var descriptor = new DateTimePicker.BDControlScriptDescriptor(GetClientControlType(), ClientID);
                ((IControl)this).DescribeComponent(descriptor);
                return new List<ScriptDescriptor>(new ScriptDescriptor[] { descriptor });
            }
        }
     
        private class BDControlScriptDescriptor : ScriptControlDescriptor, IScriptDescriptor
        {
            public BDControlScriptDescriptor(string type, string elementID)
                : base(type, elementID)
            {
            }
     
            protected override string GetScript()
            {
                return base.GetScript().Replace(@" ", " ");
            }
        }
     
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            EnableAjaxSkinRendering = true;
            Calendar.EnableAjaxSkinRendering = true;
            DateInput.EnableAjaxSkinRendering = true;
        }
    } 
  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1793 posts

    Posted 02 Sep 2015 Link to this post

    Hello Dzianis,

    Thank you for contacting us.

    Although that inherited controls are not supported, I have tested the code snippet that you have provided with our latest version and everything is working correctly and the "DatePopupButtonToolTip" is displayed as "Open the calendar popup". Furthermore, I have tested with global resources file and again, no problems occurred. 

    If the problem on your side persists, please try with our latest version and see if it will have any difference. If not, please open a regular support ticket and attach a sample, runnable project that replicates the problem, so we can test it locally.


    Regards,
    Konstantin Dikov
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Dzianis
    Dzianis avatar
    3 posts
    Member since:
    Aug 2015

    Posted 02 Sep 2015 in reply to Konstantin Dikov Link to this post

    Thank you, Konstantin!

    At the moment I resolved the problem by manual translation of values.
    I think, the problem can be related with our own global localization mechanism.

    Thanks!

  5. Dzianis
    Dzianis avatar
    3 posts
    Member since:
    Aug 2015

    Posted 03 Sep 2015 in reply to Dzianis Link to this post

    As you can see on the screenshot. We have square brackets for the value  "[DatePopupButtonToolTip]". I think our code inject the brackets before your code and your code can't find a needed value. :)
  6. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1793 posts

    Posted 07 Sep 2015 Link to this post

    Hi Dzianis,

    Can you please elaborate on the way that you are setting your custom string values in the control and if you were able to isolate the exact cause of the problem?


    Regards,
    Konstantin Dikov
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017