【发布时间】:2016-07-18 09:35:03
【问题描述】:
如果条件为真或假,我想在 ASp.net MVC 中单击按钮时显示引导模式。 比如说,如果我检查了登录凭据,如果它失败了,那么如何在引导模式或引导警报中显示错误。
<html>
<head>
<link href="~/bootstrap.min.css" rel="stylesheet" />
<script src="~/bootstrap.min.js"></script>
<script src="https://code.jquery.com/jquery-3.1.0.min.js"></script>
<script>
$(function()
{
$("#mybutton").click(function(){
var test1 = $('#test').val();
if(test1 == "Value")
$("#myModal").modal('show');
});
});
</script>
</head>
<body>
<input type="text" class="form-control" id="test" placeholder="Enter A Value" />
<button type="submit" value="Click" name="click" id="mybutton">Click Me!</button>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<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">×</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
...
</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>
</div>
</div>
</body>
</html>
如何实现???
【问题讨论】:
-
你的代码在哪里?你试过什么?
-
请用一些有效代码和您尝试过的内容更新问题。
-
嗨@BonMacalindong 更新了问题,请检查。
标签: c# asp.net .net asp.net-mvc bootstrap-modal