[CLOSED] Messagebox BringToFront (in codebehind)

  1. #1

    [CLOSED] Messagebox BringToFront (in codebehind)

    Hi,

    I'm creating a messagebox in codebehind which gives a warning in another (small) window.
    I want to show this messagebox on top of that window. Is that possible from codebehind ?

    Can not find a 'bringToFront'

    This is the code for the messagebox

    MessageBoxConfig mbc = new MessageBoxConfig();
    mbc.Title = "Ongeldige invoer";
    mbc.Message = cError;
    mbc.Buttons = MessageBox.Button.OK;
    mbc.Icon = MessageBox.Icon.ERROR;
    X.Msg.Show(mbc);
    Martin
    Last edited by geoffrey.mcgill; Aug 27, 2010 at 6:30 PM. Reason: [CLOSED]
  2. #2
    Hello!

    MessageBox is always rendered to a center of screen.
    I would suggest you to use setPagePosition of MessageBox's window.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Button_Click(object sender, DirectEventArgs e)
        {
            MessageBoxConfig mbc = new MessageBoxConfig();
            mbc.Title = "Title";
            mbc.Message = "Message";
            mbc.Buttons = MessageBox.Button.OK;
            mbc.Icon = MessageBox.Icon.ERROR;
            X.Msg.Show(mbc);
    
            int windowX = int.Parse(e.ExtraParams["x"]);
            int windowY = int.Parse(e.ExtraParams["y"]);
            int windowWidth = int.Parse(e.ExtraParams["width"]);
            int windowHeight = int.Parse(e.ExtraParams["height"]);
    
            int x = windowX + (windowWidth - 125) / 2;
            int y = windowY;
            
            String script = "Ext.Msg.getDialog().setPagePosition(" + x + "," + y + ")";
            X.AddScript(script);
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server"/>
        <ext:Window 
            ID="Window1" 
            runat="server" 
            Width="300" 
            Height="300">
            <Buttons>
                <ext:Button runat="server" Text="Show MessageBox">
                    <DirectEvents>
                        <Click OnEvent="Button_Click">
                            <ExtraParams>
                                <ext:Parameter Name="x" Value="#{Window1}.x" Mode="Raw" />
                                <ext:Parameter Name="y" Value="#{Window1}.y" Mode="Raw" />
                                <ext:Parameter Name="width" Value="#{Window1}.width" Mode="Raw" />
                                <ext:Parameter Name="height" Value="#{Window1}.height" Mode="Raw" />
                            </ExtraParams>
                        </Click>
                    </DirectEvents>
                </ext:Button>
            </Buttons>
        </ext:Window>
        </form>
    </body>
    </html>

Similar Threads

  1. [1.3] [2.0] No X.MessageBox from CodeBehind
    By ckarcz in forum 2.x Help
    Replies: 4
    Last Post: Mar 09, 2012, 4:59 PM
  2. [CLOSED] Ext.WindowMgr.bringToFront does not work
    By deejayns in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 31, 2011, 12:41 PM
  3. [CLOSED] Confirm messagebox from codebehind
    By CarWise in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 30, 2010, 1:20 PM
  4. Replies: 2
    Last Post: Sep 14, 2009, 2:50 PM
  5. [CLOSED] The "Ext.MessageBox"
    By fabiomarcos in forum 1.x Help
    Replies: 4
    Last Post: Dec 02, 2008, 1:25 PM

Posting Permissions