I am developing an ASP.NET4 C# web application with jQuery in the page that uses a master page. My content placeholder is within an update panel, but the script does not work when there are postbacks.
Master Page
<body>
<form runat ="server">
<br />
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Scripts>
<asp:ScriptReference Path="~/Scripts/jquery-1.4.4.min.js" />
<asp:ScriptReference Path="~/Scripts/jquery-ui-1.8.6.custom.min.js" />
<asp:ScriptReference Path="~/Scripts/jquery-ui-timepicker-addon.js" />
</Scripts>
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
Content Page
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
<asp:View ID="View1" runat="server">
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><script type="text/javascript">
$('#<%= TextBox1.ClientID %>').timepicker({
ampm: true,
hourMin: 8,
hourMax: 23
});
</script>
</asp:View>
<asp:View ID="View2" runat="server">
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox><script type="text/javascript">
$('#<%= TextBox3.ClientID %>').timepicker({
ampm: true,
hourMin: 8,
hourMax: 23
});
</script>
</asp:View>