I have developed a web application that uses the jQuery DateTimePicker by Trent Richardson
(see http://trentrichardson.com/examples/timepicker/)
This is a C# aps.net app, that has a field called tbDate, because I have a MasterPage, this field is known as #MainContent_tbDate to jQuery.
In the backend C# code the following line has been added to the PagePreRenderComplete event.
tbDate.Attributes.Add("onFocus", "getDate('#MainContent_tbDate');");
This as you can see simply adds an onFocus event to the field. (This works for 12 other fields)
In my .js file I have the following code.
//This function launches the date picker
function getDate(field){
if (debug)
{
$.jGrowl("Displaying Date for field " + field);
}
$(field).datetimepicker({
dateFormat:'dd/mm/yy',
timeFormat:'hh:mm'
});
if (debug) {
$.jGrowl("Launched " + field);
}
}
This is run when the field gets focus. Now the issue is the first time it does get focus I see my first jGrowl message, Then NO Date Picker, then I see my second jGrowl message.
I get no Scripting errors.
If I take focus away from the field and then give it back I see the date picker correctly.
Why don’t I see it the first time the field gets focus?????
Thanks
SM
try this: