in
Forums
Blogs
Files
Devexpress.Com
ClientCenter
Support Center
DevExpress Channel

Messagebox for Web module...?

Last post 8/28/2008 9:01 AM by Raven Angel. 4 replies.
Page 1 of 1 (5 items)
Sort Posts:
Previous Next
  • 8/28/2008 4:35 AM

    Messagebox for Web module...?

    I want to show a message in my web application using some kind of messagebox.... i tried to implement my own c# (javascript based) messagebox but it seems to fail! Is there an easy way of showing a message?

    --> This message might be a simple remark with only an OK button or it might be an YES/NO or OK/Cancel question.... so i was thinking like the Messagebox under the Windows.Forms namespace!

    It seems to me this is made way to difficult to implement, so i was hoping the framework provides this functionality... otherwise it is a shortcoming in the fralework!

     

    Any help or remarks?

     

     

     

  • 8/28/2008 5:18 AM In reply to

    Re: Messagebox for Web module...?

    Hi,

    I had the same problem and now I can show the MessageBox with this code in codebehind:

    protected void btn_Click(object sender, EventArgs e)
    {

        // Define the name and type of the client scripts on the page.
        String csname1 = "PopupScript";
        Type cstype = this.GetType();

        // Get a ClientScriptManager reference from the Page class.
        ClientScriptManager cs = Page.ClientScript;

        // Check to see if the startup script is already registered.
        if (!cs.IsStartupScriptRegistered(cstype, csname1))
       {
          String cstext1 = "alert('Test!');";
           cs.RegisterStartupScript(cstype, csname1, cstext1, true);

       }

    }

     

    ASP:

    <dxe:ASPxButton ID="btn" runat="server" AutoPostBack="False" OnClick="btn_Click"
                    Text="Test" Width="91px">
    </dxe:ASPxButton>

     

    Hope this will help you.

     

    Regards

    Jens

  • 8/28/2008 5:24 AM In reply to

    Re: Messagebox for Web module...?

     This is when you are using your own messagebox... but it shouldn't be to hard to use the confirmation form that DevExpress is using itself... i was hoping there was more information on it!

     

    regards,

  • 8/28/2008 7:03 AM In reply to

    Re: Messagebox for Web module...?

    Popping up a javascript alert box is easy. You just need to get hold of the Page object (presumably from a view controller) and add something like the following:

    Page.ClientScript.RegisterStartupScript(GetType(), "validationError", "alert('Help!');", true);

    For a confirmation box, you could do something similar, but you would need to include a javascript 'if' statement to check whether the user clicked OK or not, and then you could either do a manual postback, or call a client-side method of one of the controls on the page to trigger a postback.

    If you would like to be more specific, then I might be able to help you with an example.

  • 8/28/2008 9:01 AM In reply to

    Re: Messagebox for Web module...?

     Well,

    assume you have 2 fields which need to be the same before the save will succeed. Whenever a user selects the Save action and the two fields are not the same a messagebox should be shown giving the message "mismatch...".

    There might be other solutions for this, but i was hoping this was a good example...?

     

Page 1 of 1 (5 items)
Copyright © 1998-2008 Developer Express Inc.
ALL RIGHTS RESERVED