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

[Solved] Initial position of modal window

3 Answers 215 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
William
Top achievements
Rank 1
William asked on 23 Nov 2010, 08:12 PM
How is the initial position of a modal window determined?  We have a site where it always opens at the top-left corner, no matter where I put the Html.Telerik().Window()....Render() code.  On http://demos.telerik.com/aspnet-mvc-beta/window?theme=vista, and in simple demos I make, it seems to try to place the window where the Render() code lives, but I'm guessing mixing in some AJAX and CSS confuses the position calculation.

Thanks.

3 Answers, 1 is accepted

Sort by
0
William
Top achievements
Rank 1
answered on 23 Nov 2010, 09:24 PM
After some hacking, I think the real question is where does the window appear IF it is initially not visible.  I am trying to use a modal window for a post-AJAX error, so I initially set .Visible(false), and then do the following Javascript if an error occurs in the AJAX call:

        var w = $('#TransferWindow').data('tWindow');
        w.open();
        w.center();

Then the window appears in the top-left - and stays there.  Seems like a bug to me.
0
Alex Gyoshev
Telerik team
answered on 25 Nov 2010, 10:24 AM
Hello William,

We addressed a similar issue soon after the release. Please try your code with the attached build, and if the problem persists, send a sample project. That said, your code seems fine (and there is an upcoming demo that shows the same scenario of opening an initially hidden window). Just to mention it, the window methods are chainable, i.e.:
    $('#TransferWindow').data('tWindow').center().open();

All the best,
Alex Gyoshev
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
Tim
Top achievements
Rank 1
answered on 30 Nov 2010, 11:42 AM
Hello,


@{Html.Telerik().ScriptRegistrar()
        .OnDocumentReady(@"
            var myWindow = $('#Window');
            myWindow.data('tWindow').center().open();
        ");
}


worked for me.

Regards,
Tim
Tags
General Discussions
Asked by
William
Top achievements
Rank 1
Answers by
William
Top achievements
Rank 1
Alex Gyoshev
Telerik team
Tim
Top achievements
Rank 1
Share this question
or