0

I use Kendo Window for creating new records and render a partialview in this window. Although I can post the form data to the Controller, I cannot return the form when there is an error and need to return to the Kendo Window. Any help would be appreciated.

View:

// I call this method on ButtonClick
function openWindow(win) {
    var window = $(win).data("kendoWindow");        
    window.refresh();     
    window.center();
    window.open();
}; 


@(Html.Kendo().Window()
    .Name("winCreate")
    .Title("Create")
    .Visible(false)
    .Draggable(true)
    .LoadContentFrom("_Create", "Issue")
    .Modal(true)
    .Actions(actions => actions
        .Close()    
     )
) 

Controller:

//I tried to recall Kendo Window as below, but it cannot be rendered:
return PartialView("_Create", "Issue", issueViewModel);
Jack
  • 1
  • 21
  • 118
  • 236
  • Is there anyone else using popup window for creating new record in MVC? :( – Jack Jun 16 '15 at 07:08
  • 1
    use ajax to submit your form and handle error when you get response error there. – Dion Dirza Jun 16 '15 at 07:11
  • @DionDirza Thanks for reply. Could you give an example please? On the other hand, how to call popup from controller? I have really no idea about that. I have look at many web pages, but there is not a solution. – Jack Jun 16 '15 at 07:14
  • 1
    You don't need to reload popup, just show error message from controller to some element inside popup window page. – Dion Dirza Jun 16 '15 at 07:18
  • But when returning partial view or view from Controller, there is no popup, just another page is open. Normally I call partial view from popup window, but after returning these views there is no popup. Where do I make mistake? – Jack Jun 16 '15 at 07:21
  • 1
    Your mistake is you don't make ajax call here, you are performing normal `HTTP.Post` request to controller and return different view. Instead you should make `ajax` request to your controller when you click `submit` button which this button inside your popup page. – Dion Dirza Jun 16 '15 at 07:25
  • 1
    Please see the answer of this [question](http://stackoverflow.com/questions/26191774/submit-form-using-ajax-in-asp-net-mvc-4), it will help you to perform ajax submission form inside your popup. – Dion Dirza Jun 16 '15 at 07:31
  • @DionDirza Many thanks for your help. Yes, as you said, I need to use Ajax for submitting the form. The only problem for now is to submit attached files to the Controller, but I think I will fnd a solution for that :) Voted+ – Jack Jun 16 '15 at 08:25
  • Glad you find the way :) – Dion Dirza Jun 16 '15 at 09:00
  • @DionDirza Sorry, but I have not proceed regarding to this issue that is the on that page (related to this question): http://stackoverflow.com/questions/30868493/why-partialview-cannot-reload-with-ajax-in-mvc Have alook at please? – Jack Jun 17 '15 at 07:30

0 Answers0