This is a migrated thread and some comments may be shown as answers.

radbutton popup is blocked

7 Answers 163 Views
Button
This is a migrated thread and some comments may be shown as answers.
Ibrahim Imam
Top achievements
Rank 1
Ibrahim Imam asked on 02 Aug 2011, 09:28 AM
hello

i am currently replacing some buttons with the radbutton.
for buttons and linkbuttons i was setting the "onclick" attribute to call a JS-function which opens a popup after checking if it isn't already open which should be avoided when using radbutton.
so i adapted the code to use the radbuttons OnClientClicking property to

"function(sender,args){" + javaScriptCall + "}";

where javaScriptCall calls the JS-function which returns a window:

top.Popup1 = OpenWindowWithCheck(top.Popup1, 'url', 'errormessage','Popup1')

and here is the function:

function OpenWindowWithCheck(Window, PagePath, ErrorMessage, WindowName)
{
    if (Window == null || Window.closed) {
        Window = window.open(PagePath, WindowName);
    }
    else {
        if (confirm(ErrorMessage))
        {
            Window.close();
            Window = window.open(PagePath, WindowName);
        }
        else
        {
            Window.focus();
        }
    }
    return Window;
}

This works well except that i get a popup-blocker message by IE9 now.
How can i avoid this popup-message or is there another way to call my JS-function with radbutton?


7 Answers, 1 is accepted

Sort by
0
Slav
Telerik team
answered on 04 Aug 2011, 08:14 PM
Hello Ibrahim,

The popup-blocker message is usually an expected behavior when managing popups. Could you please verify that this message is also displayed when you call the client-side script from a regular ASP.NET Button Control?

For such scenarios I would recommend utilizing our RadWindow control, since the object it generates is not suppressed by the popup blocker mechanism. It provides other useful features as well, you can check them in the following article: RadWindow Overview. Please keep in mind that the RadWindow is limited to the ASPX page that declares it.

I hope the information listed above helps.

Greetings,
Slav
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Ibrahim Imam
Top achievements
Rank 1
answered on 08 Aug 2011, 09:05 AM
hello

unfortunately in this special case the radWindow is not an option as i need a real popup (second browser window).

if i use a asp.net button and the onclienclick event (which renders the onclick property) it works correctly (no popup blocker message).

0
Slav
Telerik team
answered on 10 Aug 2011, 04:36 PM
Hello Ibrahim,

I tried to reproduce the described behavior, but to no avail. I have attached my test project, recreating your scenario, so that you can compare it with your actual project and check if there are any differences in the setup. I have also added a short clip, demonstrating the testing: http://screencast.com/t/3XuquWU4v5L.

I would suggest that you check if the client-side event handler is attached to the correct event. The RadButton supports the following client events for click - OnClientClicking and OnClientClicked. If another another event is used, the RadButton won't function as expected.

Another approach that you may try is using a standard Button and decorating it as RadButton via the RadFormDecorator control.

If you are still experiencing difficulties after applying the solutions above, please provide more detailed description of your scenario, so that we can suggest a specific answer.

Greetings,
Slav
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Ibrahim Imam
Top achievements
Rank 1
answered on 11 Aug 2011, 09:00 AM
hello

i compared your test project with my application code.
i was using the onclienclicking event instead of onclientclicked which was the reason for the popup blocker.

if you change this in your test project you will see the "wrong" behavior.

thanks for your help
0
Slav
Telerik team
answered on 15 Aug 2011, 01:32 PM
Hi Ibrahim,

I wasn't able to reproduce the problem by replacing the used click event, as you can check in the following short clip: http://screencast.com/t/lNQjZmhVG. The standard button and the RadButton have similar effect. The encountered behavior may be caused by the settings of the browser, regarding the popup blocking mechanism.

I have attached the previous sample, slightly modified in order to utilize the OnClientClicking event. Also a standard Button control is included so that you can compare the behavior of the two buttons. Could you please change my sample in order to reproduce the problem or if not, could you provide more information on the popup blocker settings of your browser or verify if the regular Button controls uses the same client event handler as the RadButton? For the purpose of demonstration you may use the Jing screen capture tool, which is very useful and easy to use.

Best wishes,
Slav
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Ibrahim Imam
Top achievements
Rank 1
answered on 16 Aug 2011, 05:51 PM
hello

i tried the new version of your example and have the same behavior as before.
Without changing anything the popup blocker message appears.
If i change the OnClientClicking event to OnClientClicked it works correctly
i am using IE9 on Win7.
Here is a screenshot with the message and popup settings.
0
Slav
Telerik team
answered on 18 Aug 2011, 11:33 AM
Hello Ibrahim,

If the OnClientClicked event works well for you you can safely use it to implement the desired functionality.

Since you are experiencing the problem on the same project, without modifying it, it is quite possible that it is caused by the setup of your browser (for example the general Securty settings). I am sorry to say that I cannot specify the exact reason as I am still not able to reproduce the described issue.

Regards,
Slav
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Button
Asked by
Ibrahim Imam
Top achievements
Rank 1
Answers by
Slav
Telerik team
Ibrahim Imam
Top achievements
Rank 1
Share this question
or