This is a migrated thread and some comments may be shown as answers.
Is it possible to bind TimePicker DataList to Dictionary
1 Answer 8 Views
This is a migrated thread and some comments may be shown as answers.
Nick
Top achievements
Rank 1
Nick asked on 14 Apr 2011, 06:07 PM
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

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 20 Apr 2011, 09:10 AM
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.

Asked by
Nick
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or