我在我的网站上使用 ajax 日历扩展器。
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>Active From: <asp:TextBox ID="inputActiveFromDate" runat="server"></asp:TextBox>
<cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="inputActiveFromDate" PopupButtonID="btn_Calendar1" Format="dd/MM/yyyy 00:00:00"></cc1:CalendarExtender>
<asp:ImageButton runat="server" ID="btn_Calendar1" ImageUrl="../images/buttons/Lock_icon.gif" />
</td>
<td width="20"></td>
<td>Active Until: <asp:TextBox ID="inputActiveUntilDate" runat="server"></asp:TextBox>
<cc1:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="inputActiveUntilDate" PopupButtonID="btn_Calendar2" Format="dd/MM/yyyy 23:59:59"></cc1:CalendarExtender>
<asp:ImageButton runat="server" ID="btn_Calendar2" ImageUrl="../images/buttons/Lock_icon.gif" />
</td>
</tr>
</table>
一切正常,但我在所有浏览器上都收到此错误。
> Unable to set value of the property 'PopupBehavior': object is null or
> undefined
请帮我解决
错误来了
// Name: MicrosoftAjax.debug.js
// Assembly: AjaxControlToolkit
// Version: 4.1.50508.0
// FileVersion: 4.1.50508
// (c) 2010 CodePlex Foundation
initialize: function Behavior$initialize() {
Sys.UI.Behavior.callBaseMethod(this, 'initialize');
var name = this.get_name();
if (name) this._element[name] = this;// error place <---
},
我的 CS 代码:
using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["DBConn"].ToString())){
String sql = "INSERT INTO tablename (SDate,EDate) VALUES ('" + Convert.ToDateTime(inputActiveFromDate.Text) + "','" + Convert.ToDateTime(inputActiveUntilDate.Text) + "'); SELECT @@IDENTITY;";conn.Open();
SqlCommand comm = new SqlCommand(sql, conn);
comm.ExecuteNonQuery();
// int lastId = Convert.ToInt32(comm.ExecuteScalar());
conn.Close();
}