Advertisement
Guest User

Untitled

a guest
May 20th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AnEvenBetterControl.ascx.cs" Inherits="namespacing_javascript_post1.AnEvenBetterControl" %>
  2.  
  3. <p>
  4. An even better control
  5. </p>
  6. <div id="<%=ControlNamespace%>_button" class="btn btn-default">Submit</div>
  7.  
  8. <p>
  9. <span id="<%=ControlNamespace%>_label1"></span>
  10. </p>
  11.  
  12. <script>
  13.  
  14. var namespace = '<%=ControlNamespace%>';
  15.  
  16. (function (namespace) {
  17.  
  18. var module = (function () {
  19. var app = {};
  20.  
  21. app.submitButtonClick = function () {
  22.  
  23. $('#' + namespace + '_label1').text('I have been clicked');
  24.  
  25. };
  26.  
  27. app.namespace = function (ns) {
  28. window[ns] = app;
  29. window.module = null;
  30. }
  31.  
  32. return app;
  33. }());
  34.  
  35. $('#' + namespace + '_button').click(function (event, args) {
  36.  
  37. window.<%=ControlNamespace%>.submitButtonClick();
  38. });
  39.  
  40. module.namespace(namespace);
  41.  
  42. })(namespace);
  43. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement