在asp.NET中更新更新面板时,Jquery无法使用更新面板
未捕获的Sys.InvalidOperationException:Sys.InvalidOperationException:找不到UpdatePanel。
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="datepicker.aspx.cs" Inherits="WebApplication1.datepicker" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>
$(document).ready(function () {
$("#dater").datepicker({
changeMonth: true,
changeYear: true
});
});
</script>
</head>
<body>
<form runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<p>
Pick a Date:
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:TextBox ID="dater" runat="server" AutoPostBack="true" OnTextChanged="dater_TextChanged"></asp:TextBox>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</ContentTemplate>
</asp:UpdatePanel>
</p>
</form>
</body>
</html>
答案 0 :(得分:1)
试试这个:
$(function () {
$("#dater").datepicker({
changeMonth: true,
changeYear: true
});
});
$(document).ready(function () {
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function EndRequestHandler(sender, args) {
$("#dater").datepicker({
changeMonth: true,
changeYear: true
});
}
});
答案 1 :(得分:0)
不仅在日期选择器中,同样的问题就像工具提示消息一样,模型视图中的控件正在使用jquery和更新面板