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

[Solved] Displaying multiple windows

9 Answers 340 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.
Neil
Top achievements
Rank 1
Neil asked on 16 Mar 2012, 01:05 PM
I am using the Window control which is working great.  The problem I'm having is that I need a second window to open from the first.  I've tried lots of variations in order to achieve this, but with no luck.  I know that the ASP .NET Ajax controls have a Window Manager and this can be done using that.  Is there something similar for MVC?

9 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 19 Mar 2012, 10:49 AM
Hello Neil,

There is no window manager in the MVC, but you can create windows on the client side through the window client API, either by calling the window create method or by creating an element and using the tWindow jQuery plug-in directly.

Kind regards,
Alex Gyoshev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Neil
Top achievements
Rank 1
answered on 19 Mar 2012, 11:05 AM
Hi,
This is working well, apart from when I close the window.  It says:

Microsoft JScript runtime error: Unable to get value of the property 'modal': object is null or undefined

Any ideas?
0
Alex Gyoshev
Telerik team
answered on 19 Mar 2012, 12:37 PM
Without seeing some code, we could only guess. Are you by any chance trying to destroy the window in the close event handler?

Kind regards,
Alex Gyoshev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Neil
Top achievements
Rank 1
answered on 19 Mar 2012, 12:44 PM
The code below is where I'm creating the new window.  I am loading this from an already instantiated and visible Telerik Window, which is modal.  It's just a simple thank-you dialogue, but when I try to closing it, I get the error.
<script type="text/javascript">
    var thankyouElement = $.telerik.window.create({
        title: "Thank you",
        html: "<strong>Thank you dialogue</strong>",
        contentUrl: "",
        actions: ["Close"],
        modal: true,
        resizable: false,
        draggable: false,
        visible: false,
        width: 300,
        height: 200,
        scrollable: false,
        onClose: function () { return; }
    });
</script>

The return was just added in to try and stop it from failing.
0
Alex Gyoshev
Telerik team
answered on 22 Mar 2012, 12:38 PM
Hello Neil,

We were unable to reproduce the issue -- see the following jsFiddle. Please provide more details on how the problem occurs.

Kind regards,
Alex Gyoshev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Neil
Top achievements
Rank 1
answered on 22 Mar 2012, 12:44 PM
Ok, straight away I can see that you are creating all of your windows using the javascript method.  I am creating the initial window using @(Html.Telerik().Window()) etc. method, and then using the javascript create method inside of that.
0
Alex Gyoshev
Telerik team
answered on 22 Mar 2012, 03:54 PM
Hello Neil,

The attached solution does what you describe, and we did not reproduce the error. If that is not your scenario, please adjust the solution so that it shows the problem.

Greetings,
Alex Gyoshev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Neil
Top achievements
Rank 1
answered on 26 Mar 2012, 02:39 PM
I want to unmark the answer as this doesn't fit the requirements.  Below is a code snippet of what I'm trying to do.  The Preview window is associated to a Grid, so the user can click the "View detail" button and a new window opens.  If I click the "View Detail" button first, then it displays and then I can click the "Request Resize" button, and that too will display.  But if I click the "View Detail" button again, I get an error.

<button type="button" id="RequestResize">Request Resize</button>
 
@{Html.Telerik().Window()
    .Name("Preview")
    .Visible(false)
    .Title("Asset Details")
    .Modal(true)
    .Width(500)
    .Height(300)
    .Content(@<text>
        @using (Html.BeginForm("Versionalise", "Asset", FormMethod.Post))
        {
        <div id="viewAsset">
            <img />
            <h2></h2>
            <details></details>
        </div>
        <button type="submit" id="submit" value="">Select</button>
        <button id="cancelButton" type="button" onclick="cancelDetails()">Cancel</button>
        }
    </text>)
    .Render();
}
 
<script type="text/javascript">
    function openResizeWindow() {
        var windowElement = $.telerik.window.create({
            title: "Request Resize",
            html: "",
            actions: ["Close"],
            modal: true,
            resizable: false,
            draggable: false,
            visible: false,
            width: 600,
            height: 450,
            scrollable: false
        });
        windowElement.data("tWindow").ajaxRequest("/Asset/Resize");
        windowElement.data("tWindow").center().open();
    }
</script>
 
@{Html.Telerik().ScriptRegistrar()
      .OnDocumentReady(@<text>
        $('#RequestResize').click(openResizeWindow);
      </text>);
}
0
Alex Gyoshev
Telerik team
answered on 26 Mar 2012, 03:40 PM
Hello Neil,

Does the /Asset/Resize partial include a second jQuery on the page? If yes, remove the second jQuery declaration, as it will remove all widget client-side objects. If not, please modify the project in a way that fits your requirements, as the pasted snippet does not give us enough information.

Kind regards,
Alex Gyoshev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
Tags
Window
Asked by
Neil
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Neil
Top achievements
Rank 1
Share this question
or