MVC3 partial view for edit pop-up

Go To StackoverFlow.com

1

I am writing a MVC3 project. Right now I have a table which has column with Data as actionLinks as:

<td style="color: Black; background-color: Bisque; text-align: center; width: 410px">
                @Html.ActionLink(@item.LookUp_NameString, "EditPartial", "Capitation", new { id = item.CAPITATION_RATE_ID }, new { @class = "actionLink" })
            </td>

EditPartial as the name suggests is a partial view, which I need to be opened as a pop-up menu so that user can edit the details of the object save it and we can come back to original page.

Thanks for the help!

2012-04-05 17:44
by OBL


1

You could use jQuery and jQueryUi to capture the click and open the rendered action in a dialog box.

<div id="popupWindow" style="display: none;" ></div>

<script type="text/javascript">     
    $(function() {
        $("#popupWindow").dialog({
            width: 600,
            autoOpen: false
        }); 

        $('a.actionLink').click(function() {
            var url = $(this).attr('href');
            $('#popupWindow').load(url, function() {
                $('#popupWindow').dialog('open');
            });
            return false;
        });
    }); 
</script>
2012-04-05 18:03
by Ron DeFreitas
will this pass the value of id? or does that need an ajax call - OBL 2012-04-05 18:31
erroring: Microsoft JScript runtime error: '$.ui.dialog.defaults' is null or not an objec - OBL 2012-04-05 18:49
This is based on your original code sample...., it will pass over to the action that renders your partial view whatever variable you have put into the url.

As for your exception, Did you include JQueryUI - Ron DeFreitas 2012-04-05 20:44

@OBL, did you include jQueryUI in your page before getting that exception - Ron DeFreitas 2012-04-06 15:44
Yes I did that. :- - OBL 2012-04-06 20:44
Because of the error it is re-directing to the partial view instead of showing it as a pop up. Rest works great. Thanks - OBL 2012-04-06 20:51
Could it be because I am using @Html.ActionLink(@item.LookUpNameString, "EditPartial", "Capitation", new { id = item.CAPITATIONRATE_ID }, new { @class = "actionLink" }),

Which is actually re-directing me to the other view? Also the error occurs in IE only - OBL 2012-04-06 21:03

sorry, the bgiframe option isn't needed any longer.. - Ron DeFreitas 2012-04-10 14:20
Ads