日期选择器是不是有更新面板工作 [英] Date picker is not working with update panel
本文介绍了日期选择器是不是有更新面板工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的应用程序是asp.net 3.5中对此我选择从日期选择器是内部更新面板日期。选择日期并点击提交按钮后,页面是回传。之后回来后,当我尝试再次选择日期我不能老是看日期选择器那里。
My application is in asp.net 3.5 in which i am selecting date from date picker which is inside update panel. after selecting date and clicking on submit button page is post back. after post back when i try to select date once again i can`t see date picker there.
// aspx页面上code
//Code on aspx page
<%@ Page Title="" Language="C#" MasterPageFile="~/Sample/MasterPage.master" AutoEventWireup="true" CodeFile="UpdateProblem.aspx.cs" Inherits="Sample_UpdateProblem" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script type="text/javascript" src="jscolor/jscolor.js"></script> // Script for date
<asp:ScriptManager ID="ScriptManager1" runat="server" >
</asp:ScriptManager>
<div>
<asp:UpdatePanel ID="panel1" runat="server">
<ContentTemplate>
<asp:TextBox runat="server" ID="textbox" CssClass="color" />
<asp:Button ID="Button1" runat="server" Text="Button" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:Content>
在此先感谢
推荐答案
在您的UpdatePanel添加CSS类在测试盒
In your UpdatePanel add css class on your test box
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:TextBox ID="TextBox1" runat="server" CssClass="classTarget"></asp:TextBox>
.....
</ContentTemplate>
</asp:UpdatePanel>
在脚本中添加此code
In your script add this code
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.1.js">
</script>
<script type="text/javascript">
$(document).ready(function() {
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function EndRequestHandler(sender, args) {
$('.classTarget).datepicker({ dateFormat: 'dd-mm-yy' });
}
});
</script>
这篇关于日期选择器是不是有更新面板工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文