locked
Opening Modal Window through an Image Control is not working RRS feed

  • Question

  • I have been trying to do a button click on an Image control. From there I would open a Modal Window but I keep receiving this error: 

    Control <controlName> doesn't contain a modal window.  OpenModalWindow/CloseModalWindow cannot be used.

    my code is extremely simple: 

            partial void EditableTestingsGrid_Created()
            {
    
                this.FindControl("Image").ControlAvailable += EditableTestingsGrid_ControlAvailable;
            }
    
            void EditableTestingsGrid_ControlAvailable(object sender, ControlAvailableEventArgs e)
            {
                Image img = (Image)e.Control;
                img.MouseLeftButtonUp += WitnessImage_LeftButtonClick;
            }
    
    
            private void WitnessImage_LeftButtonClick(object sender, MouseButtonEventArgs e)
            {
    
                this.OpenModalWindow("Group1");
            }

    The odd part is that when I try and click that same image again, It works! I only receive this error on the first click of the image. I've tried everything including putting the code inside of a Dispatcher and checking the access to the dispatcher before executing the code. 

    Wednesday, September 24, 2014 5:08 PM

Answers

  • Hi,

    You could try to add the image into a customized button.

    When you add a new button , you could import an image into the new button from local.

    Then you could add the open window code to the button execute method after you click on Edit Execute Code .

    Here has an article which has talked about this, please have a see:

    http://code.msdn.microsoft.com/windowsdesktop/Add-buttons-and-commands-16a0fba5

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.




    • Marked as answer by Angie Xu Friday, October 3, 2014 2:37 AM
    Thursday, September 25, 2014 8:49 AM