Asp.Net UpdatePanel in Gridview Jquery DatePicker(Gridview Jquery DatePicker中的Asp.Net UpdatePanel)
问题描述
<asp:UpdatePanel ID="asd" runat="server">
<ContentTemplate>
<asp:GridView ID="gvUpdate" runat="server">
<Columns>
<asp:TemplateField HeaderText="DATE">
<ItemTemplate>
<asp:Label ID="lblDate" runat="server" Text='<%# Eval("DATE","{0:dd.MM.yyyy}")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtDate" runat="server" Text='<%# Eval("DATE","{0:dd.MM.yyyy}") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</ContentTemplate>
我想要 jquery datepicker for "txtDate" 如何制作?
i want jquery datepicker for "txtDate" how to make ?
谢谢...
推荐答案
最简单的方法是在你的日期文本框上放置一个类,然后使用jQuery添加日期选择器...
The most simple way is to place a class on your Date Text box, and just use jQuery to add the datepicker...
<EditItemTemplate>
<asp:TextBox ID="txtDate" CssClass="clDate"
runat="server" Text='<%# Eval("DATE","{0:dd.MM.yyyy}") %>'></asp:TextBox>
</EditItemTemplate>
init 的 javascript 是:$(".clDate").datepicker(); 但是更新面板需要在更新后再次初始化,所以最终的代码是:
and the javascript for init this is: $(".clDate").datepicker(); but the update panel is need again initialization after the Update, so the final code will be:
<script type="text/javascript">
// if you use jQuery, you can load them when dom is read.
$(document).ready(function () {
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_initializeRequest(InitializeRequest);
prm.add_endRequest(EndRequest);
// Place here the first init of the DatePicker
$(".clDate").datepicker();
});
function InitializeRequest(sender, args) {
// make unbind to avoid memory leaks.
$(".clDate").unbind();
}
function EndRequest(sender, args) {
// after update occur on UpdatePanel re-init the DatePicker
$(".clDate").datepicker();
}
</script>
更新:关于系统.-> http://msdn.microsoft.com/en-us/library/bb311028.aspx
Update:About the Sys. -> http://msdn.microsoft.com/en-us/library/bb311028.aspx
这篇关于Gridview Jquery DatePicker中的Asp.Net UpdatePanel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Gridview Jquery DatePicker中的Asp.Net UpdatePanel
- C#MongoDB使用Builders查找派生对象 2022-09-04
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- 输入按键事件处理程序 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
