Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Ajax > Open a rad confirm window client side on button click of Rad Button
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Not answered Open a rad confirm window client side on button click of Rad Button

Feed from this thread
  • Jaya avatar

    Posted on Apr 20, 2011 (permalink)

    Hi , 
    I have implemented Ajax in my page , i have a rad button 'DeActivate' and when i click that i have  to get a rad confirm box . I need to open the window from client side. I have wirtten the OnClientClicked event , but when i click the button , the confirm box open and page gets refreshed immediately.
    Thanks in advance
    Jaya

    Code :

    Button for which i want the confirm box to open 
     <telerik:RadButton ID="btnActivte" runat="server"  ValidationGroup="Save" OnClientClicked="OpenActivate" 
                    Text="DeActivate" CssClass="radButton" Enabled="false">
                    <Image ImageUrl="~/Images/Default/Components/cp_button_bg.png" IsBackgroundImage="true"
                        HoveredImageUrl="~/Images/Default/Components/hover.jpg" />               
                </telerik:RadButton>  

    JavaScript :

     function OpenActivate() {
                    var masterTableView = $find("<%=rgUsers.ClientID %>").get_masterTableView();
                    var id = masterTableView.get_selectedItems()[0].getDataKeyValue("Location");
                    var isActive = masterTableView.get_selectedItems()[0].getDataKeyValue("IsActive");
                    var msg = 'deactivation';
                    if (isActive == 'True')
                    { msg = 'deactivation'; }
                    else
                    { msg = 'activation'; }
                    radconfirm('<h3 style=\'color: #333399;\'>Please confirm ' + msg + ' of User Maintenance  ' + id + '?</h3>', CinfirmActivate, 330, 100, null, 'User Maintenance');
                }


                function CinfirmActivate(arg) {
                    if (arg == true) {
                        __doPostBack('', 'Activate');


                    }
                    else {
                        var oManager = GetRadWindowManager();
                        eval("oManager.closeActiveWindow()");
                    }
                }

  • Marin Bratanov Marin Bratanov admin's avatar

    Posted on Apr 21, 2011 (permalink)

    Hi Jaya,

    The issue here is the postback from the button. There are two possible approaches to solve this:

    1. attach to the OnClientClicking event as it is cancellable and call the args.set_cancel(true) method to prevent the postback, since you execute it manually in the callback function.
    2. alternatively, you could use the AutoPostBack property of the RadButton and set it to false since you do the postback manually and you generally want an ajaxified page. In that case you wouldn't need to call the set_cancel(true) method.

    Please note that:

    • in order for the set_cancel() method to be available you would need to pass the sender and args arguments to the event handler (function OpenActivate(sender, args) )
    • in order for the button to be clickable at all you need to set its Enabled property to true


    Kind regards,
    Marin
    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.

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Ajax > Open a rad confirm window client side on button click of Rad Button