jQWidgets Forums
Forum Replies Created
-
Author
-
Peter, rather than providing the input dates for stringTime, I just commented out the two calls to .jqxDateTimeInput(“setDate”, …) and I still receive the same error on the first keystroke inside the control at run-time. It doesn’t appear to be related to the format of the input datetime.
Any other ideas?
That’s an excellent question. I’m afraid that was just a poor job of copying and pasting example code. I removed it but it didn’t fix my problem.
$('#divFirstStart').jqxDateTimeInput({ width: '120px', height: '20px', formatString: 'T', showCalendarButton: false, theme: 'darkblue' });$('#divLastStart').jqxDateTimeInput({ width: '120px', height: '20px', formatString: 'T', showCalendarButton: false, theme: 'darkblue' }); $("#divFirstStart").jqxDateTimeInput("setDate", ConvertToDate(document.getElementById('<%=txtFirstStart.ClientID%>').value));$("#divLastStart").jqxDateTimeInput("setDate", ConvertToDate(document.getElementById('<%=txtLastStart.ClientID%>').value));$('#divFirstStart').bind('valuechanged', function(event) { document.getElementById('<%=txtFirstStart.ClientID%>').value = event.args.date.toTimeString(); });$('#divLastStart').bind('valuechanged', function(event) { document.getElementById('<%=txtLastStart.ClientID%>').value = event.args.date.toTimeString(); });
I also experimented with moving the container div outside of the UpdatePanel and still received the same error.
Also, here is the ConvertToDate function (I borrowed it from another post in your forum)
function ConvertToDate(stringTime) {
var date = new Date();
hours = stringTime.substr(0, 2);
minutes = stringTime.substr(3, 2);
date.setHours(parseInt(hours));
date.setMinutes(parseInt(minutes));return date;
}
Right now I am just testing by plugging the current time into those elements in HH:mm:ss format. So, for instance I just ran it in debug and it had 16:30:45 for both values.
Trying the snippet again –
<asp:UpdatePanel ID="UpdatePanel2" runat="server"> <ContentTemplate> <div class="windowContent" style="width:880px; height:555px;"> <script type="text/javascript"> function initOptionsWindow() { $('#divFirstStart').jqxDateTimeInput({ width: '120px', height: '20px', formatString: 'T', showCalendarButton: false, theme: 'darkblue' }); $('#divLastStart').jqxDateTimeInput({ width: '120px', height: '20px', formatString: 'T', showCalendarButton: false, theme: 'darkblue' }); $("#divFirstStart").jqxDateTimeInput("setDate", new Date(ConvertToDate(document.getElementById('<%=txtFirstStart.ClientID%>').value))); $("#divLastStart").jqxDateTimeInput("setDate", new Date(ConvertToDate(document.getElementById('<%=txtLastStart.ClientID%>').value))); $('#divFirstStart').bind('valuechanged', function(event) { document.getElementById('<%=txtFirstStart.ClientID%>').value = event.args.date.toTimeString(); }); $('#divLastStart').bind('valuechanged', function(event) { document.getElementById('<%=txtLastStart.ClientID%>').value = event.args.date.toTimeString(); }); $("#divLastStart").jqxDateTimeInput('_arrange'); } </script> <div style="float:left">The first game of the day starts at </div> <div id="divFirstStart"></div> <div style="float:left"> and last game starts at </div> <div id="divLastStart" style="float:left"></div> <asp:Button ID="Button2" runat="server" Text="Button" /> <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label> </div> <input id="txtFirstStart" type="hidden" runat="server" /> <input id="txtLastStart" type="hidden" runat="server" /> </ContentTemplate> </asp:UpdatePanel>
-
AuthorPosts