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

Window content

5 Answers 308 Views
Window
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Michael Dunbar
Top achievements
Rank 2
Michael Dunbar asked on 10 Nov 2010, 03:30 PM
Hello,

I'm currently just playing around with the Telerik MVC extensions as we are planning on using the MVC3 Beta Release candidate, released yesterday, on a new project. So far, so good. One quick question though. Can you load views or partial views as content of the window? This may not be appropriate use and am happy to hear alternative approaches if so, as I am an MVC newby coming from ASP.NET forms.

I am basically thinking of using the window to load a form wizard. The wizard will probably be built using a series of views. Here is my very basic test project code that renders a window in a partial view, but can I load a view or another partial view into this? Should I indeed do this? Sorry to be so vague and thanks in advance.

@using Telerik.Web.Mvc.UI
 
@(
    Html.Telerik().Window()
        .Name("Window")
        .Title("Telerik Window for ASP.NET MVC")
        .Draggable(true)
        .Resizable(resizing => resizing
            .Enabled(true)
            .MinHeight(250)
            .MinWidth(500)
            )
        .Modal(true)
        .Buttons(b => b.Maximize().Close())
        .Content(() =>
        {
            // content? can you load a view?
        })
        .Width(800)
        .Height(600)
        .ClientEvents(events => events
            .OnLoad("onWindowLoad")
        )
         
)
 
<script type="text/javascript">
    function onWindowLoad(e) {
        var window = $(this).data('tWindow');
        window.center().open();
    }
</script>

5 Answers, 1 is accepted

Sort by
0
Michael Dunbar
Top achievements
Rank 2
answered on 10 Nov 2010, 04:08 PM
I have just found the .LoadContentFrom property, but although I can load an external web page I haven't yet figured how to load a view. I tried:

.LoadContentFrom("http://www.google.co.uk") // works
.LoadContentFrom("Index", "HomeController") // not found but does exist as a view
0
Accepted
Atanas Korchev
Telerik team
answered on 10 Nov 2010, 06:08 PM
Hello Michael Dunbar,

 This example shows how to load a partial view. If you need to load a whole page - check this example.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Damian
Top achievements
Rank 1
answered on 28 Jan 2011, 07:16 PM

I’m getting an 'undefined' error trying to open a Window via a button click. 
I believe I have followed the Telerik guidance on how to do this, however, it does not work.  It seems like the javascript does not find the window object and that is what is throwing the error.

Please the screen shots below and the sample code included with this document.

0
Nate
Top achievements
Rank 1
answered on 12 May 2011, 06:23 PM
Damian, have you figured out how to load a view into the window? Not a partial view but a viewpage.
0
Nate
Top achievements
Rank 1
answered on 12 May 2011, 06:24 PM
Michael, have you gotten a viewpage to load into a window? I get the same 404 error.

.LoadContentFrom("Index", "HomeController") // not found but does exist as a view
Tags
Window
Asked by
Michael Dunbar
Top achievements
Rank 2
Answers by
Michael Dunbar
Top achievements
Rank 2
Atanas Korchev
Telerik team
Damian
Top achievements
Rank 1
Nate
Top achievements
Rank 1
Share this question
or