Hai
I am creating a MVC4 razor Application using Kendo controls. In my application I supposed to open a view as popup. For that I am using kendow window control. Am using the below code to open the popup.
@(Html.Kendo().Window()
.Name("Searchwindow")
.Title("user Search")
.LoadContentFrom("../usersearch")
.Draggable()
.Resizable()
.Width(700)
.Visible(false)
The view is open as popup and works fine. But whenever the post action occurs in the view the page is opened as page like http://localhost:4376/usersearch.
I have to show the same popup to the user when the form is posted. How to show the same popup when an action is posted on the view page? Is it possible to open the view as popup after the action completion?
Thanks
6 Answers, 1 is accepted

You post form data, then you would like to show a kind of message in a popup window but instead it loads the message view in the main window?
I mean, your issue is that it is doing a full postback?

Thanks

I don't know if it is possible through mvc extensions, though for this case if you need it here is the html and javascript code you would need:
<
div
id
=
"Searchwindow" name="Searchwindow" style="width:700px"
></
div
>
$(
'#Searchwindow'
).kendoWindow({
title:
"user Search"
,
content:
"../usersearch"
,
iframe:
true
,
visible:
false
}).data(
'kendoWindow'
).center();
If the relative url '../usersearch' doesn't work try to use the absolute url (it should create by default the iframe but just in case we set the flag to true).
The ".data('kendoWindow').center()" part is optional, just to have the window centered when you make it visible

thanks for your reply.. Your solution is not working for me. i have uploaded the resulted view page snap shot when the user click submit button. I have a simple application. In that search user link will be shown in the home page. When the user click on that link user window will be shown within a kendow window.
This is code i have used in layout
<script type="text/javascript">
$(document).ready(function () {
$("#user").bind("click", function () {
var window = $("#userwindow").data("kendoWindow");
window.center();
window.open();
});
});
</script>
</head>
<body>
<a href="#" id="user">Search User</a>
<div class="tabscontent">
@RenderBody()
</div>
@(Html.Kendo().Window()
.Name("userwindow")
.Title("User")
.LoadContentFrom("../User/Index1")
.Draggable()
.Resizable()
.Width(736)
.Visible(false)
.Modal(true)
)
</body>
If i click on the submit button in the pop up the popup is closed and the view is opened as plain page.. My requirement is when the user clicks the submit i need to do db action in the controller and i have to show the same popup again. How to achieve this?
Thanks

Or you need to do the post in the popup, the result will be displayed in the page but having still the popup opened? [case2]
case 1:
Right now I think that the mvc helper for the kendo window does not have the option to make it use an iframe, so any form inside the window will put the response in the page doing a postback.
To fix it for now until kendo team updates these features in their helpers, you will need to create the window via javascript, so 0 mvc helper code.
case 2:
In case you are trying to achieve this, you will have to post the data with jquery in an ajax way, and in the callback function place the result you get on the page. That would not close the popup and you would get the result in the page.

//js
<
script
>
('#divFoo').load("/Controller/Action")
</
script
>
@Html.kendo().window().name("wdwFoo").content(@<
text
><
div
id
=
"divFoo"
></
text
>)
Create a partial view, use the jquery call back function to then load a div tag with in your window using ('#mydiv').load(callbackmsg). You can also us jquery ajax but load() will ensure that your window gets the newwest data