Change Dialog Location

2 posts, 0 answers
  1. Scott
    Scott avatar
    1 posts
    Member since:
    Sep 2013

    Posted 27 Sep 2013 Link to this post

    I am using Telerik.Web.UI version 2011.1.315.35, and the default location of the dialog is centered in the browser. I am trying to explicitly specify the startup location. I have seen an example that involved setting the "OnClientLoad" property in the code-in-front (ascx or aspx), but that Javascript method doesn't seem to be being called.

    How can I specify the startup location of the dialog?

    Thanks,
    Scott
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 01 Oct 2013 Link to this post

    Hi Scott,

    Here is the code I used and it seemed to work fine for me (with your version as well):
    <asp:TextBox ID="Textbox1" runat="server" Text="mizpelled textt" />
    <telerik:RadSpell ID="RadSpell1" runat="server" OnClientLoad="OnClientLoad" ControlToCheck="Textbox1" />
    <script type="text/javascript">
        function OnClientLoad(sender, args)
        {
            if (sender && sender.get_dialogOpener && sender.get_dialogOpener()._container)
                sender.get_dialogOpener()._container.add_pageLoad(setDialogPosition);
        }
        function setDialogPosition(sender, args)
        {
            setTimeout(function ()
            {
                sender.moveTo(10, 10);
            }, 0);
        }
    </script>

    If this does not work for you, you can replace the OnClientLoad handler with a pageLoad() handler (i.e. the Sys.Application.Load event) and $find() the RadSpell instance, instead of getting it as the first parameter of its own event handler.

    Regards,
    Marin Bratanov
    Telerik
    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 RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top