Posted By

elijahmanor on 07/16/09


Tagged


Versions (?)

Code Snippet


 / Published in: HTML
 

  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CodeSnippet.aspx.cs" Inherits="Playground.CodeSnippet" %>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3.  
  4. <html xmlns="http://www.w3.org/1999/xhtml" >
  5. <head id="ctlHead" runat="server">
  6. <title>Playground</title>
  7. <script src="jquery-1.3.2.min.js" type="text/javascript"></script>
  8. <script src="jquery.blockUI.js" type="text/javascript"></script>
  9. </head>
  10. <form id="ctlForm" runat="server">
  11. <asp:Button id="ctlAddContact" runat="server" Text="Add Contact" />
  12. <div id="ctlAddContactModal" style="display: none;">
  13. <h3>Add Contact</h3>
  14. <dl>
  15. <dt><asp:Label ID="lblFirstNameCaption" runat="server" AssociatedControlID="txtFirstName" Text="First Name" /></dt>
  16. <dd><asp:TextBox ID="txtFirstName" runat="server" /></dd>
  17. <dt><asp:Label ID="lblLastNameCaption" runat="server" AssociatedControlID="txtLastName" Text="Last Name" /></dt>
  18. <dd><asp:TextBox ID="txtLastName" runat="server" /></dd>
  19. </dl>
  20. <div class="buttons">
  21. <asp:Button ID="btnCancel" runat="server" Text="Cancel" />
  22. <asp:LinkButton ID="btnSave" runat="server" Text="Save" onclick="btnSave_Click" />
  23. </div>
  24. </div>
  25. <script type="text/javascript">
  26. $(function() {
  27. $('#<%= ctlAddContact.ClientID %>').click(function(e) {
  28. e.preventDefault();
  29. $.blockUI({
  30. message: $('#ctlAddContactModal'),
  31. });
  32. });
  33.  
  34. $('#<%= btnCancel.ClientID %>').click(function(e) {
  35. $.unblockUI();
  36. });
  37.  
  38. var btnSaveId = '<%= btnSave.ClientID %>';
  39. $('#' + btnSaveId).click(function(e) {
  40. e.preventDefault();
  41. $.unblockUI({
  42. onUnblock: function() {
  43. eval($('#' + btnSaveId).attr('href'));
  44. }
  45. });
  46. });
  47. });
  48. </script>
  49. </form>
  50. </body>
  51. </html>

Report this snippet  

You need to login to post a comment.