MVC Partial View to Call Display Pop-up window using jquery
- by Gavin campbell
Hi
I have a index page the renders objects from my database as a treeview, each item has a link href="/MessageGroupType/Edit/1002 that makes an Ajax call to display a partial view in a DIV.
Within the partial view there is a delete button which calls my controller to delete the item.
However, i do a check to make sure the item can be deleted, if the item cant be deleted then i wish a pop-up to appear back on the edit form telling the user they cant delete this record.
In my Edit partial view i have the following code
" type="text/javascript"
$(function() {
$("#dialog").dialog();
});
<% if (Boolean.Parse(ViewData["DisplayWindow"].ToString())){%
This Mesage group Type Cannot be deleted as is linked to other message group Types
<% }%
So my main questions are
Can i make a reference to a javascript script within my Partial View (i dont want my master page to be called on the partial view)
When i dynamically load the partial view data into my DIV - can i then after calling my controller insert another DIV into the first DIV.
I am i doing this the wrong way - so any pointers is appreciated
Cheers