How to open a new page on click of desktopalert

5 posts, 0 answers
  1. VIJESH
    VIJESH avatar
    13 posts
    Member since:
    Oct 2012

    Posted 09 Dec 2012 Link to this post

    Hi 

    I am using desktopalert control in my windows form. I want to know how I can redirect to a new page on clicking the desktopalert (by clicking anywhere on the desktopalert or on the captiontex or on the caption image).

    Also I want to know how can I make this application which would wake up every x minutes and check our database for some condition and display the desktopalert.

    Thanks
  2. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 13 Dec 2012 Link to this post

    Hello Vijesh,

    You can do this by using the click event of RadDesktopAlert popup. Consider the following sample:

    RadDesktopAlert alert = new RadDesktopAlert();
    alert.CaptionText = "Hello world";
    alert.ContentText = "I am a simple desktop alert message.";
    alert.Popup.Click += new EventHandler(Popup_Click);
    alert.Show();
     
    void Popup_Click(object sender, EventArgs e)
    {
        MessageBox.Show("Alert clicked!");
    }

    Find further details about RadDesktopAlert in our online documentation.

    You can wake up your application by using a timer. Consider this MSDN forum thread for an example.

    If you need further assistance, I will be glad to help.

    Regards, Jack
    the Telerik team
    Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. VIJESH
    VIJESH avatar
    13 posts
    Member since:
    Oct 2012

    Posted 13 Dec 2012 Link to this post

    Hi Jack,

    Thanks for your reply.
    The code which you sent is working fine for me. But on click of close button or pin button, the message box is displaying.
  5. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 14 Dec 2012 Link to this post

    Hello Vijesh,

    You can avoid this by checking the element that is currently located under the mouse. Do this by calling the GetElementAtPoint method. Here is a sample:
    void Popup_Click(object sender, EventArgs e)
    {
        DesktopAlertPopup popup = (DesktopAlertPopup)sender;
        Point pt = popup.PointToClient(Control.MousePosition);
        RadButtonElement button = popup.ElementTree.GetElementAtPoint(pt) as RadButtonElement;
        if (button != null)
        {
            return;
        }
        MessageBox.Show("Hello world!");
    }

    Regards,
    Jack
    the Telerik team
    Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
  6. VIJESH
    VIJESH avatar
    13 posts
    Member since:
    Oct 2012

    Posted 14 Dec 2012 Link to this post

    Hi Jack,

    Your code works fine for me. Thank you so much.

    Regards,
    VIJESH
Back to Top
UI for WinForms is Visual Studio 2017 Ready