Is it possible to bind TimePicker DataList to Dictionary

2 posts, 0 answers
  1. Nick
    Nick avatar
    17 posts
    Member since:
    Oct 2010

    Posted 14 Apr 2011 Link to this post

    Hello,

    By Looking here:  http://demos.telerik.com/aspnet-ajax/calendar/examples/datetimepicker/customcollection/defaultcs.aspx
    I can see that I can bind RadTimePicker control to custom collections of DateTime objects. In the example you bind it to List, ArrayList, DateTime array and Object array.

    I want to bind it to Dictionary<DateTime, string> and have something similar like you have in comboBox:
    ComboBox.DataTextField = "Key";
    ComboBox.DataValueField = "Value";


    Is it possible to do in DatePicker?

    Thanks,
    Nick
  2. Tsvetina
    Admin
    Tsvetina avatar
    2481 posts

    Posted 20 Apr 2011 Link to this post

    Hello Nick,

    As the data-binding documentation article states:
    When embedding the RadTimePicker control inside a data-bound control, use a data-binding expression to bind the value of the input control to the data source of the parent control. In addition to calling Eval and Bind methods to perform data binding in a data-binding expression, you can call any publicly scoped code within the <%# and %> delimiters to execute that code and return a value during page processing.

    This means that you can use custom code to provide a value for the control, but it does not have such properties as those of RadComboBox. This is expected since the RadDateInput control of the RadTimePicker allows only time input, not any kind of string. If you wish the time value look differently than it does in the datasource, you can use a format string to modify it through the DateFormat property of the DateInput.

    Greetings,
    Tsvetina
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top