code_junkie

jquery datepicker ms ajax updatepanel doesn't work after post back

Nov 14th, 2011
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. <script type="text/javascript">
  2. $(function() {
  3. $(".mydatepickerclass").datepicker({dateFormat: 'dd-mm-yy'});
  4. });
  5. </script>
  6.  
  7. <asp:UpdatePanel ID="HistoryUpdatePanel" runat="server">
  8. <ContentTemplate>
  9. <%-- Start of Company History section --%>
  10. <fieldset>
  11. <legend>Activity History</legend>
  12.  
  13. <script type="text/javascript">
  14. $(function() {
  15. $(".mydatepickerclass").datepicker({dateFormat: 'dd-mm-yy'});
  16. });
  17. </script>
  18.  
  19. <div>
  20. <asp:ListBox ID="listBoxHistoryTypes" runat="server" SelectionMode="Multiple" AutoPostBack="true" OnSelectedIndexChanged="listBoxHistoryTypes_IndexChanged" />
  21. <label>Date From:</label><asp:TextBox class="mydatepickerclass" ID="txtdatefrom" runat="server" />
  22. <label>Date To:</label><input class="mydatepickerclass" type="text" />
  23. <asp:TextBox class="mydatepickerclass" ID="txtdateto" runat="server" />
  24. <asp:Button ID="btnFilterSearch" runat="server" Text="Filter Results" OnClick="btnFilterSearch_Click" />
  25. </div>
  26.  
  27.  
  28. </fieldset>
  29. </ContentTemplate>
  30.  
  31. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  32. <html xmlns="http://www.w3.org/1999/xhtml">
  33. <head runat="server">
  34. <title></title>
  35. <script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.1.js">
  36. </script>
  37. <script type="text/javascript">
  38. $(document).ready(function() {
  39. Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
  40.  
  41. function EndRequestHandler(sender, args) {
  42. $('.mydatepickerclass').datepicker({ dateFormat: 'dd-mm-yy' });
  43. }
  44.  
  45. });
  46. </script>
  47. </head>
  48. <body>
  49. <form id="form1" runat="server">
  50. <div>
  51.  
  52. </div>
  53. <asp:ScriptManager ID="ScriptManager1" runat="server">
  54. </asp:ScriptManager>
  55. <asp:UpdatePanel ID="UpdatePanel1" runat="server">
  56. <ContentTemplate>
  57. <asp:TextBox ID="TextBox1" runat="server" CssClass="mydatepickerclass"></asp:TextBox>
  58. <br />
  59. <asp:Button ID="Button1" runat="server" Text="UpdateMe"
  60. onclick="Button1_Click" />
  61. </ContentTemplate>
  62. </asp:UpdatePanel>
  63. </form>
  64. </body>
  65. </html>
Add Comment
Please, Sign In to add comment