标签:
<script> $(function () { $(‘.myDatePickerClass‘).datepicker({ dateFormat: ‘yy-mm-dd‘ }); }); </script> <asp:TemplateField HeaderText="UpdateETD2" SortExpression="UpdateETD"> <EditItemTemplate> <asp:TextBox ID="TextBoxDate" runat="server" Text=‘<%# Eval("UpdateETD") %>‘ CssClass=‘myDatePickerClass‘></asp:TextBox> </EditItemTemplate> <ItemTemplate><%# Eval("UpdateETD") %></ItemTemplate> </asp:TemplateField>
<script> // 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 $(".myDatePickerClass").datepicker(); }); function InitializeRequest(sender, args) { // make unbind to avoid memory leaks. $(".myDatePickerClass").unbind(); } function EndRequest(sender, args) { // after update occur on UpdatePanel re-init the DatePicker $(".myDatePickerClass").datepicker(); } </script> <asp:TemplateField HeaderText="UpdateETD2" SortExpression="UpdateETD"> <EditItemTemplate> <asp:TextBox ID="TextBoxDate" runat="server" Text=‘<%# Eval("UpdateETD") %>‘ CssClass=‘myDatePickerClass‘></asp:TextBox> </EditItemTemplate> <ItemTemplate><%# Eval("UpdateETD") %></ItemTemplate> </asp:TemplateField>
GridView中使用 jQuery DatePicker (UpdatePanel)
标签:
原文地址:http://www.cnblogs.com/moonache/p/5219985.html