1.
<div id="divToShowJSResult"></div>
<div id='dialogDiv' class="modal fade" role="dialog"> <div id='dialogContent' class="modal-dialog"> <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> </div> <div class="modal-body"> <h1>This is dialog div</h1> <p>You have selected to delete this notification.</p> <p> If this was the action that you wanted to do, please confirm your choice, or cancel and return to the page. </p> </div> <div class="modal-footer"> <button type="button" class="btn btn-success" data-dismiss="modal">Cancel</button> <button type="button" class="btn btn-danger" id="deleteConfirm">Delete Notification</button> </div> </div> </div> </div>
@Ajax.ActionLink("Test JavaScript", "ShowProductsByCategoryID", new { CategoryID = item.CategoryID },
new AjaxOptions { UpdateTargetId = "divToShowJSResult" })
public ActionResult ShowProductsByCategoryID(Int32 CategoryID) { // IList<Person> Persons = db.Person.ToList(); //ViewBag.message = @"<script type='text/javascript' language='javascript'>alert(""Hello World!"")</script>"; ViewBag.message = @"<script type='text/javascript' language='javascript'>test(" + CategoryID + ")</script>"; return Content(ViewBag.message); // return PartialView("_mypartial"); }
<script type="text/javascript"> function test(catid, personcount) { console.log("test called"); console.log(personcount); $('#dialogDiv').modal('show'); } </script>
0 comments:
Post a Comment