Advertisement
Guest User

a

a guest
Feb 12th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.39 KB | None | 0 0
  1. //Neesmine funkcija bet cia del supratimo kokia naudoju jquery dialogine forma.
  2. function OpenContactAddressDialog() {
  3. var cntID = $("#txtCntID").val();
  4.  
  5. if (cntID > 0) {
  6. var dialog = $("#dialog-area").dialog({
  7. dialogClass: "no-close",
  8. autoOpen: false,
  9. resizable: false,
  10. show: {
  11. effect: "blind",
  12. duration: 1000
  13. },
  14. hide: {
  15. effect: "explode",
  16. duration: 1000
  17. },
  18. height: 500,
  19. width: ($(window).width() - 50 < 400) ? ($(window).width() - 50) : (400),
  20.  
  21. modal: true,
  22. buttons: [
  23. {
  24. text: "Close",
  25. click: function () {
  26. FormatContactAddress(cntID);
  27. $(this).dialog("close");
  28. }
  29. }
  30. ]
  31. });
  32.  
  33. var loaded = LoadContactAddress(cntID);
  34.  
  35. if (loaded) {
  36. dialog.dialog("open");
  37. } else
  38. {
  39. window.location.href = "/Home/Index";
  40. }
  41.  
  42. }
  43. else {
  44. BootstrapDialog.alert("Please select a contact first!");
  45. }
  46. return false;
  47. }
  48.  
  49.  
  50. // is ajaxo perkraunu dar karta modaline forma
  51. $.ajax({
  52. cache: false,
  53. async: false,
  54. type: "GET",
  55. dataType: "html",
  56. url: "/ContactAddress/Index",
  57. data: { "ContactID": cntID },
  58. success: function (data) {
  59. $("#dialog-area").html(data);
  60. result =true;
  61.  
  62. },
  63. error: function (xhr, ajaxOptions, thrownError) {
  64. alert('Could not retrieve Contact address!');
  65. result=false;
  66. }
  67. });
  68.  
  69.  
  70.  
  71.  
  72.  
  73. //MVC .NET razor viewas:
  74. @Using Ajax.BeginForm("Edit", "ContactAddress", New AjaxOptions With {.HttpMethod = "POST", .OnSuccess = "OnAddressSuccess", .OnFailure = "OnAddressFailure"})
  75.  
  76. @Html.AntiForgeryToken()
  77.  
  78. @<div class="row">
  79. <div Class="col-md-12">
  80. @Html.Label("Country")
  81. @Html.DropDownList("CountryList", Nothing, "- Select Country -", New With {.class = "form-control"})
  82. </div>
  83. </div>
  84.  
  85. @<div class="row">
  86. <div Class="col-md-12">
  87. @Html.Label("Type")
  88. @Html.DropDownList("ContactAddrTypeList", Nothing, "- Select Type -", New With {.class = "form-control"})
  89. </div>
  90. </div>
  91.  
  92. @<div class="row">
  93. <div class="col-md-12">
  94. @Html.Label("Is Main")<br />
  95. @Html.CheckBox("ckbMain", If(IsNothing(Model), True, If(Model.cnaIsMain = "Y", True, False)))
  96. </div>
  97. </div>
  98.  
  99. @<div class="row">
  100. <div class="col-md-12">
  101. @Html.Label("Address 1")
  102. @Html.TextBox("txtAddress1", If(IsNothing(Model), String.Empty, Model.cnaAddr1), New With {.class = "form-control"})
  103. </div>
  104. </div>
  105.  
  106. @<div class="row">
  107. <div class="col-md-12">
  108. @Html.Label("Address 2")
  109. @Html.TextBox("txtAddress2", If(IsNothing(Model), String.Empty, Model.cnaAddr2), New With {.class = "form-control"})
  110. </div>
  111. </div>
  112.  
  113. @<div class="row">
  114. <div class="col-md-12">
  115. @Html.Label("Town")
  116. @Html.TextBox("txtTown", If(IsNothing(Model), String.Empty, Model.cnaTown), New With {.class = "form-control"})
  117. </div>
  118. </div>
  119.  
  120. @<div class="row">
  121. <div class="col-md-12">
  122. @Html.Label("Region")
  123. @Html.TextBox("txtRegion", If(IsNothing(Model), String.Empty, Model.cnaRegion), New With {.class = "form-control"})
  124. </div>
  125. </div>
  126.  
  127.  
  128. @<div class="row">
  129. <div Class="col-md-12">
  130. @Html.Label("Post Code")
  131. @Html.TextBox("txtPostCode", If(IsNothing(Model), String.Empty, Model.cnaPostCode), New With {.class = "form-control"})
  132. </div>
  133. </div>
  134.  
  135. @<div class="row">
  136. <div class="col-md-12">
  137. @Html.Label("Salut")
  138. @Html.TextBox("txtSalut", If(IsNothing(Model), String.Empty, Model.cnaSalut), New With {.class = "form-control"})
  139. </div>
  140. </div>
  141.  
  142. @<div class="row">
  143. <div class="col-md-12">
  144. @Html.Label("Is Active")<br />
  145. @Html.CheckBox("ckbActive", If(IsNothing(Model), True, If(Model.cnaActive = "Y", True, False)))
  146. </div>
  147. </div>
  148.  
  149. @<div class="row">
  150. <div class="col-md-12">
  151. @Html.Label("Is Post Code First")<br />
  152. @Html.CheckBox("ckbPCodeF", If(IsNothing(Model), True, If(Model.cnaPCodeF = "Y", True, False)))
  153. </div>
  154. </div>
  155.  
  156. @<div class="row">
  157. <div class="col-md-12">
  158. @Html.Hidden("txtCnaID", If(IsNothing(Model), String.Empty, Model.cnaID), New With {.id = "txtCnaID"})
  159. @Html.Hidden("txtCntID", If(IsNothing(Model), String.Empty, Model.cna_cntID), New With {.id = "txtCntID"})
  160. </div>
  161. </div>
  162.  
  163. @<input type="submit" value="Save" class="btn btn-primary" />
  164.  
  165. End Using
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement