1

I have a very basic question. I am developing a login page in .cshtml format. Now I want to implement a modal in bootstrap without using a button. Like if the "condition is wrong" in login credentials then show the modal. I give you the condition below. technically I see lots of bootstraps available with buttons but I do not want that. I want the modal to execute automatically. or the HTML part of the modal to get triggered without a data target.

 @if (ViewContext.ModelState.IsValid == false)//condition for login failure, its in a file called _validation summary.cshtml

{
// Modal html we may change it.
    <div class="modal fade" tabindex="-1" role="dialog">
        <div class="modal-dialog" 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">&times;</span></button>
                    <h4 class="modal-title">Modal title</h4>
                </div>
                <div class="modal-body">
                    <p>One fine body&hellip;</p>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-primary">Save changes</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
}

Thanks in advance, Jay

Jayanta Deb
  • 11
  • 1
  • 4
  • Possible duplicate of [How to open a Bootstrap modal window using jQuery?](https://stackoverflow.com/questions/13183630/how-to-open-a-bootstrap-modal-window-using-jquery) – Nisarg Shah Aug 06 '18 at 09:33

0 Answers0