Remark : PartialView sample diagram
Index View (중략)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
<div id="dialog" class="modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <!-- PartialView : RuleTest --> </div> <script type="text/javascript"> function RuleTest(id) { var Key = $("#" + id).val(); $.ajax({ type: "POST", url: "/Display/Test", data: { AirFareDisplayRuleKey: Key }, //contentType: "application/html; charset=utf-8", dataType: "html", success: function (response) { $('#dialog').html(response); $('#dialog').modal('show'); //bootstrap modal }, failure: function (response) { alert(response.responseText); }, error: function (response) { alert(response.responseText); } }); } //}); </script> |
Control (중략)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
[HttpPost] public IActionResult Test(string AirFareDisplayRuleKey) { try { string sAirFareRules = "test..."; ViewData["AirFareRules"] = sAirFareRules; } catch { } return PartialView("Test"); } |
PartialView Test (중략)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
<div class="modal-dialog modal-lg" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel"> 테스트</h4> </div> <div class="modal-body"> <table class="table table-bordered table-striped"> <tbody> <tr> <th scope="row" width="9%">원본</th> <td></td> </tr> <tr> <th scope="row">번역</th> <td class="font-weight-bold" style="white-space:pre-line">@Html.Raw(ViewData["AirFareRules"])</td> </tr> </tbody> </table> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div> </div> |