I have added my RadDateTimePicker to a asp:Repeater. on first load the data binding will be empty and this cause the error Value of '1/1/0001 12:00:00 AM' is not valid for 'SelectedDate'. 'SelectedDate' should be between 'MinDate' and 'MaxDate'
i would like to know how to i set the selecteddate to empty string or null value.
i have tried to set the selecteddate to current datetime, but it screw up the timepicker format and the interval setting
i tried doing DateTime.Now.ToString("dd/MM/yyy HH:mm") and got the error
System.FormatException: String was not recognized as a valid DateTime
my markup
01.<asp:Repeater ID="rptReplyDate" runat="server" OnItemDataBound="rptReplyDate_ItemDataBound">02. <HeaderTemplate>03. <table cellpadding="0px" cellspacing="0px" class="mainTable">04. </HeaderTemplate>05. <FooterTemplate>06. </table>07. </FooterTemplate>08. <ItemTemplate>09. <tr>10. <td style="padding: 1em 1em;">11. <table cellpadding="0px" cellspacing="0px" class="repeaterTable">12. <tr>13. <td>14. <telerik:RadDateTimePicker ID="txtReplayDate" runat="server" SelectedDate='<%# Convert.ToDateTime( DataBinder.Eval(Container.DataItem, "completetion")) %>'>15. <TimeView TimeFormat="HH:mm:ss" runat="server">16. </TimeView>17. <DateInput DisplayDateFormat="dd/MM/yyyy HH:mm" runat="server">18. </DateInput>19. </telerik:RadDateTimePicker>20. </td>21. </tr>22. 23. </table>24. </td>25. </tr>26. </ItemTemplate>27.</asp:Repeater>my code
01.protected void Page_Load(object sender, EventArgs e)02. {03. if (!Page.IsPostBack)04. {05. List<ReplayDate> col = new List<ReplayDate>();06. ReplayDate newData = new ReplayDate();07. newData.completetion = DateTime.Now.ToString();08. newData.id = 0;09. col.Add(newData);10. rptReplyDate.DataSource = col;11. rptReplyDate.DataBind();12. 13. }14.}15. public class ReplayDate16. {17. public int id { get; set; }18. public string completetion { get; set; }19. }