Error: cannot call methods on dialog prior to initialization; attempted to call method 'open'

Error: cannot call methods on dialog prior to initialization; attempted to call method 'open'

Hi Friends,

      I'm using dialog in asp.net mvc4 and jQuery 1.10.2. When I click a button I'm calling this function. But it shows the error.

"Error: cannot call methods on dialog prior to initialization; attempted to call method 'open' "

Source:
======
1) This code belongs to client side.

callUploadDialog = function () {
        var url = '@Url.Action("PartialUploadFilePopup", "Case")';
        var title = 'MdAgree - Upload patient consent form';
        InitializeUploadDialog($("#UploadDialogDiv"), url, title);
        $("#UploadDialogDiv").dialog('open');
    }

<div id="UploadDialogDiv">
    <iframe id="myIframe" src="" class="myFrameClass"></iframe>
</div>
================================================

2) InitializeUploadDialog is in seperate js file.

function InitializeUploadDialog($element, url, title) {
        $element.dialog({
            autoOpen: false,
            width: 360,
            height: 180,
            resizable: false,
            draggable: true,
            model: true,
            closeText: 'x',
            title: title,
            closeOnEscape: true,
            Open: function (event, ui) {
                $("#myIframe").show();
                $("#myIframe").attr("src",url);
            },
            Close: function () {
                $(this).dialog('close');
            }
        });
    }