Guest User

Untitled

a guest
Nov 18th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.32 KB | None | 0 0
  1. @model List<Info>
  2.  
  3. @{
  4. ViewBag.Title = "InfoPage";
  5. }
  6. </br></br></br></br>
  7.  
  8. <div id="DetailDIV"></div>
  9.  
  10. <table class="table table-bordered table-responsive table-hover">
  11. <tr>
  12. <th>Info</th>
  13. <th>stuff</th>
  14. <th>more info</th>
  15. <th>Created</th>
  16. </tr>
  17. @foreach (var item in Model)
  18. {
  19. <tr onclick="DetailedView(@item.Info_ID)">
  20. <td>
  21. @item.InfoTitle
  22. </td>
  23. <td>
  24. @item.stuff
  25. </td>
  26. <td>
  27. @item.moreInfo
  28. </td>
  29. <td>
  30. @item.Create_Date
  31. </td>
  32. </tr>
  33. }
  34. </table>
  35.  
  36.  
  37. function DetailedView(id) {
  38. var url = '@Url.Action("GetInfoModal", "Info", new { Info_ID = "replaceToken" })'.replace("replaceToken", id);
  39. $("#DetailDIV").load(url, function (responseTxt, statusTxt, xhr) {
  40. // debugger;
  41. if (statusTxt == "success") {
  42. $('body #DetailModal').modal('show');
  43. }
  44. if (statusTxt == "error") {
  45. console.log("Error: " + xhr.status + ": " + xhr.statusText);
  46. }
  47. });
  48. }
  49. </script>
  50.  
  51. @model Info
  52.  
  53.  
  54. <!-- Modal -->
  55. <div class="modal fade" id="DetailModal" tabindex="-1" role="dialog" aria-labelledby="DetailModalLabel">
  56. <div class="modal-dialog" role="document">
  57. <div class="modal-content">
  58. <div class="modal-header">
  59. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  60. <span aria-hidden="true">&times;</span>
  61. </button>
  62. <h4 class="modal-title" id="DetailModalLabel">@Model.InfoTitle</h4>
  63. </div>
  64. <div class="modal-body">
  65. <div>
  66. <div class="col-md-6">
  67. more info stuff...
  68. </div>
  69. <div class="col-md-6">
  70. even more info stuff
  71. </div>
  72. <div width="100%">
  73. <button id="QuestionButton" type="button" class="btn btn-primary" onclick="OpenQuestionBox()">Message</button>
  74. <div id="QuestionBox" hidden>
  75. <textarea id="QuestionContent" placeholder="Question Content"></textarea>
  76. <button type="button" class="btn btn-primary" onclick="SendQuestion(@Model.info_ID)">Send Message</button>
  77. </div>
  78. </div>
  79. </div>
  80. <div class="modal-footer">
  81. <button type="button" class="btn" data-dismiss="modal">Close</button>
  82. @*<button type="submit" class="btn btn-primary">Save Changes</button>*@
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88.  
  89. <script type="text/javascript">
  90. function OpenQuestionBox() {
  91. $('#QuestionButton').hide();
  92. $('#QuestionBox').show();
  93. }
  94. }
  95. </script>
  96.  
  97. $.ajax({
  98. url: '@Url.Action("SendQuestion", "Info", new { content = "Content~text", InfoID = "Info_id" })'.Replace("Content~text", text).Replace("Info_id", id),
  99. type: 'POST',
  100. dataType: 'json',
  101. data: {
  102. content: text,
  103. Info_id: id
  104. },
  105. success: function (result) {
  106. alert(result);
  107. }
  108. });
Add Comment
Please, Sign In to add comment