0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【C#】画面メッセージを出したい

Posted at

やること

出し方

CS
TempData["MESSAGE"] = "メッセージ";
_Layout.cshtml
@if (!String.IsNullOrEmpty((string)TempData["MESSAGE"]))
{

    <!-- モーダル・ダイアログ -->
    <div class="modal fade" id="messageModal" tabindex="-1">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span>×</span></button>
                    <h4 class="modal-title">メッセージ</h4>
                </div>
                <div class="modal-body">
                    @TempData["MESSAGE"]
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">閉じる</button>
                </div>
            </div>
        </div>
    </div>

    <script>
        window.onload = function viewModal() {
            $('#messageModal').modal();
        }
    </script>
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?