MVC Partial View to Call Display Pop-up window using jquery

Posted by Gavin campbell on Stack Overflow See other posts from Stack Overflow or by Gavin campbell
Published on 2010-04-22T13:20:38Z Indexed on 2010/04/22 13:23 UTC
Read the original article Hit count: 1575

Filed under:
|
|

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

  1. 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)
  2. 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.
  3. I am i doing this the wrong way - so any pointers is appreciated

Cheers

© Stack Overflow or respective owner

Related posts about mvc

Related posts about partial-views