Hello Guyz,
I am trying to Open a Bootstrap Modal Window in MVC.
But no success yet.
Below is the jQuery code:
<script type="text/javascript">
$(document).ready(function () {
$('.viewInfo').click(function () {
debugger;
var url = $(this).attr('href');//$('#signup').data('url');
$.get(url, function (data) {
$('#signup').html(data);
$('#signup').modal('show');
});
});
});
</script>
Partial View :
<div id="myModal" tabindex="-1" style="background-color: #FFFFFF;margin: 10% auto 0;width: 50%;" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Modal header</h3>
</div>
<div class="modal-body">
<p>One fine body…</p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary">Save changes</button>
</div>
</div>
Action Method:
public ActionResult ShowDialog(int iBrandID = 0)
{
var data = (from tbl in oDataContext.tblVehicleBrands
where tbl.BrandID == iBrandID
select tbl).SingleOrDefault<tblVehicleBrand>();
return PartialView(data);
}
@Html.ActionLink("View Info", "ShowDialog", "Home", new { id = @vehiclBrand.BrandID }, new { @class = "viewInfo"})
Modal is opening as full page.
Any help would be appreciated.
Thanks,
Vinay