c# - Ajax calenderextender SelectedDate value is always null. -
i have run problem have textbox calenderextender ajaxtoolkit. retrieve value user puts in. how code looks like
<asp:textbox id="txtvalidfrom" runat="server" textmode="datetime" autopostback="true" ></asp:textbox> <asp:textbox id="txtvalidto" runat="server"></asp:textbox> <ajaxtoolkit:calendarextender id="exvalidfrom" runat="server" targetcontrolid="txtvalidfrom" firstdayofweek="monday" format="dd/mm/yyyy"></ajaxtoolkit:calendarextender> <ajaxtoolkit:calendarextender id="exvalidto" runat="server" targetcontrolid="txtvalidto" firstdayofweek="monday" format="dd/mm/yyyy"> </ajaxtoolkit:calendarextender>
and code behind:
logg.validfrom = exvalidfrom.selecteddate; logg.validto = exvalidto.selecteddate;
where validfrom , validto datetime? variables. no matter user presses null value. have tried take text direct textbox using
logg.validfrom = system.convert.todatetime(txtvalidfrom.text); logg.validto = system.convert.todatetime(txtvalidto.text);
but error
string not recognized valid datetime.
any ideas how solve this?
Comments
Post a Comment