Datepicker not working on dialog that was created inside the form

Datepicker not working on dialog that was created inside the form


I'm having a problem with using the datepicker plugin on a dialog.
I have changed the dialog control so that ASP.Net controls that are
placed in it can cause a post-back.
I needed this change because the dialog div was being created outside
the forms tags and therefore any control in this div would not cause a
post back.
The changes I made in the UI.Dialog.js script are as follows:
Ln 48:
//.appendTo(document.body)
.appendTo((document.forms[0] != null) ? document.forms[0] :
document.body)
Ln 211:
//(uiDialog.next().length && uiDialog.appendTo(’body’));
(uiDialog.next().length && uiDialog.appendTo(’form’));
Ln 554:
//var $el = $(”).appendTo(document.body)
var $el = $(”).appendTo((document.forms[0] != null) ? document.forms
[0] : document.body)
This fixed the problem of not being able to cause a post back from
asp.net controls.
However now I'm trying to use the datepicker plugin on an input field
on one of those dialogs:
SCRIPT
$(
function(){
$("#<%= txtDate2.ClientID %>").datepicker
();
}
);
}
);
HTML
<asp:TextBox ID="txtDate2" runat="server" />
The _getInst:function now returns an undefined object whenever I try
to select a date, change a month or year.
I've tried adding the datepicker div to the form instead of the
document body but this does not work.
Any input would help loads.