RAD Calendar

2 posts, 0 answers
  1. Pelumi
    Pelumi avatar
    4 posts
    Member since:
    Nov 2014

    Posted 04 Feb 2015 Link to this post

    I am pretty new to RadCalendar.
    How can I bind RadCalendar to a local database?
    The aim is for the RadCalendar to show the Database inputs.


    Any Help will be appreciated 

    Regards
  2. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 09 Feb 2015 Link to this post

    Hello Pelumi,

    Thank you for writing.

    RadCalendar offers FocusedDate property which indicates the current selection. If I understand your requirement correctly, you are trying to bind a DateTime property coming from the data base to the RadCalendar. For this purpose you can use simple data binding. Here is a sample code snippet demonstrating how to bind the RadCalendar.FocusedDate property to the custom Item.CreatedOn property. When you update the custom object's property, the RadCalendar.FocusedDate property will be refreshed:
    public Form1()
    {
        InitializeComponent();
        Item item = new Item(123,"Custom Item", new DateTime(1990,04,25));
        this.radPropertyGrid1.SelectedObject = item;
         
        this.radCalendar1.DataBindings.Add("FocusedDate", item, "CreatedOn",
            true, DataSourceUpdateMode.OnPropertyChanged);
    }
     
    public class Item : System.ComponentModel.INotifyPropertyChanged
    {
        private int id;
        private string name;
        private DateTime createdOn;
     
        public Item(int id, string name, DateTime createdOn)
        {
            this.id = id;
            this.name = name;
            this.createdOn = createdOn;
        }
     
        public event PropertyChangedEventHandler PropertyChanged;
         
        protected virtual void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
     
        public int Id
        {
            get
            {
                return this.id;
            }
            set
            {
                this.id = value;
                OnPropertyChanged("Id");
            }
        }
     
        public string Name
        {
            get
            {
                return this.name;
            }
            set
            {
                this.name = value;
                OnPropertyChanged("Name");
            }
        }
         
        public DateTime CreatedOn
        {
            get
            {
                return this.createdOn;
            }
            set
            {
                this.createdOn = value;
                OnPropertyChanged("CreatedOn");
            }
        }
    }

    If it is not the exact requirement, please give us same more details about the exact scenario that you are trying to achieve. Thus, we would be able to assist you further.

    I hope this information helps. Should you have further questions, I would be glad to help.

    Regards,
    Dess
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top