Problem with Modal Dialog jquery and Function Close

Hi, i have a problem with a modal dialog, the close function dont close the modal, i dont know why?  

"btn" is it button that I click.

My code is the next:

    $("#btn").click(function () {
     
        aRow = jQuery("#BudgetGrid").jqGrid('getGridParam','selrow');
        if (aRow)
        {
            var ret = jQuery("#BudgetGrid").jqGrid('getRowData',aRow);
            var iId = ret.Id;
            $('#my-dialog').dialog({
                autoOpen: false,
                width: 400,
                datatype:"json",
                resizable: false,
                modal: true,
                open: function (event, ui) {
                   $(this).load("@Url.Action("_BudGetForm")",{id:iId});

                },
                buttons:
                {
                "Ok":function(){
                    $.ajax({
                        url: '/Budget/BudgetUpdate/',
                        type: 'POST',
                        cache: false,
                        loadComplete: function() {
                                        alert("grid is loaded/reloaded");
                        },
                        onComplete:function(){
                            RefrescarGrid();
                        },
                        data: { iBudgetId: $("#hdBudgetId").val(), sDescription:$("#DESCRIPTION").val()  },
                        success: function (result) {
                                    $("#BudgetGrid").GridUnload();
                                    CreateGrid();
                                    console.log(result);
                                    if (result!=undefined) {
                                       
                                    } else {
                                    jAlert("Data error read!!");
                    }
                        }
                    });
                }
                ,
                Close:function(){
                    alert('dddd');
                    $(this).dialog('close');     ///// DONT WORK!!
                    $(this).dialog("destroy").remove()   //// DONT work!!!
                }
            }
            });

            $('#my-dialog').dialog('open');
           
        }
        else
        {
        jAlert("Select line to edit!!..")
        };
    });

Regards and thanks for you help! HerediSoft-527956.flv HerediSoft-527956.flv
HerediSoftAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michel PlungjanIT ExpertCommented:
Can you create a jsfiddle.net for it?
0
HerediSoftAuthor Commented:
Thanks for answer!, basically i need when the modal window show it, my button close created, allow close the modal window no with button "x".

Example:

http://jsfiddle.net/ksGCb/6/

Regards,


0
HerediSoftAuthor Commented:
Had that re-code the script in my solution, the project is MVC 3 and jquery and the solution was return a partial view.
 
Thanks for you help mplungjan. ;)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HerediSoftAuthor Commented:
find the solution in the next url :

http://iwantmymvc.com/dialog-form-with-jqueryui-and-mvc-3
0
Michel PlungjanIT ExpertCommented:
Great you found it
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.