This is a migrated thread and some comments may be shown as answers.

Need help with nested windows

1 Answer 85 Views
Window
This is a migrated thread and some comments may be shown as answers.
Randy Hompesch
Top achievements
Rank 1
Randy Hompesch asked on 15 Jun 2019, 02:43 PM

Hi,

I'm so close I can taste it.

I have a razor page (we'll call Main) and it pops a windows from a button called AddItem.

That window, (AddItem) will pop another window from a button on it called AddFeature.

I can get the windows popping up just fine. However when I try to submit the form on the AddFeature window. I can't figure out how to close it afterward.

Bottom line is that when I click to save the new feature, the window does not close. The post happens and things get saved to the db, but it appears that my code to close the window does not get called. The code below is heavily redacted so there may be some typos but it should get the idea across.

The question remains, what's the right way to do this?

Any help would be great.

Code below:

 

<body>
    <div class="container-fluid body-content">
 
        @(Html.Kendo().Window()
             .Name("AddItem")
          //   .Width(100)
         //    .Height(100)
             .Resizable()
             .Modal(true)
             .Scrollable(true)
             .Title("Add New User")
             .Visible(false)
             .Actions(actions => actions.Refresh().Minimize().Maximize().Close())
             .Content("loading ...")
             .LoadContentFrom(Url.Content("~/Admin/AddItem"))
        .Animation(true)
        .Draggable(true)
        )
        <form method="post" id="frmMain" asp-page-handler="Main" asp-page="Main">
.
.
.
javascript function to pop window in response to button click
 function OnNewItem()
        {
            var win = $("#AddNewItem").data("kendoWindow");
            win.center().open();
        }
 
 
// now  on the item page we have a button that pops the following window
 
<body>
    <div class="container-fluid body-content">
 
        @(Html.Kendo().Window()
             .Name("AddNewFeature")
             .Resizable()
             .Modal(true)
             .Scrollable(true)
             .Visible(false)
             .Actions(actions => actions.Refresh().Minimize().Maximize().Close())
             .Content("loading ...")
             .LoadContentFrom(Url.Content("~/Admin/AddFeature"))
        .Animation(true)
        .Draggable(true)
        )
        <form method="post" id="frmItem" asp-page-handler="Item" asp-page="Item">

.

.

.

// now on the feature page:

 <body>
    <form asp-route-returnUrl="@Model.ReturnUrl" asp-page-handler="NewFeature" asp-page="NewFeature" method="post" id="theNewFeatureForm">

…

 

<input type="submit"  id="update-button" onclick="DoSave();" class="btn btn-primary" value="Save" />
 
 
…
 
        function DoSave()
        {
              $('#theNewFeatureForm').submit(function (e)
               {
                e.preventDefault();
                
 
                $.ajax({
                        url: '/Admin/AddNewFeature',
                        type: 'POST',
                        dataType: 'json',
                        data: $(this).serialize(),
                    success: function (data)
                    {
                                    var win = $("#AddNewFeature").data("kendoWindow");
                                    win.close();
                    }
                    });
 
                 
 
            });

 

 

 

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 19 Jun 2019, 04:29 PM
Hi Randy,

I addressed your inquiry in the support ticket with same subject you submitted. Let me know whether the suggested modifications helped in resolving the issue.

Regards,
Ivan Danchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Window
Asked by
Randy Hompesch
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or