我想使用 datetimepicker 但它给出了错误:
TypeError: Object # has no method 'datetimepicker'
我包括了这个脚本:
<script src="Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="Scripts/jquery-ui-1.8.19.custom.min.js" type="text/javascript"></script>
<script src="Scripts/jquery-ui-timepicker-addon.js" type="text/javascript"></script>
还有我的代码:
TextBox dtPicker_ = new TextBox();
dtPicker_.ID = "dt_" + i;
dtPicker_.CssClass = "datePicker";
dtPicker_.Attributes.Add("checkId", "ch_" + i);
dtPicker_.Text = cell_value_format_.Trim();
control_ = dtPicker_;
// ConvertToTimePicker
string csname1 = "BindDatePickerScript";
Type cstype = this.GetType();
// Get a ClientScriptManager reference from the Page class.
ClientScriptManager cs = Page.ClientScript;
// Check to see if the startup script is already registered.
if (!cs.IsStartupScriptRegistered(cstype, csname1))
{
System.Text.StringBuilder cstext1 = new System.Text.StringBuilder();
cstext1.Append("<script type='text/javascript'>");
cstext1.Append("$('.datePicker').datetimepicker({ dateFormat: 'dd.mm.yy' });");
cstext1.Append("</script>");
cs.RegisterStartupScript(cstype, csname1, cstext1.ToString());
}
最后我的“日期选择器”功能正在工作
cstext1.Append("$('.datePicker').datepicker({ dateFormat: 'dd.mm.yy' });");
但是“datetimepicker”说没有找到
cstext1.Append("$('.datePicker').datetimepicker({ dateFormat: 'dd.mm.yy' });");