Show Confirm dialog on radtoolbar button click

2 posts, 1 answers
  1. Ivy
    Ivy avatar
    30 posts
    Member since:
    Feb 2013

    Posted 04 Mar 2013 Link to this post

    Hi,

    I want to open a confirm dialog on clicking a particular RadToolBar Button. Is this possible? Please help.

    Thank you,
    Ivy.
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 04 Mar 2013 Link to this post

    Hello,

    Please have a look at the following code I tried to display a confirm dialog when a RadToolBar Button is clicked.

    ASPX:
    <telerik:RadToolBar ID="RadToolBar" runat="server" OnClientButtonClicking="onClientButtonClicking"
        OnButtonClick="RadToolBar_ButtonClick">
        <Items>
            <telerik:RadToolBarButton runat="server" Text="File">
            </telerik:RadToolBarButton>
            <telerik:RadToolBarButton runat="server" Text="Exit">
            </telerik:RadToolBarButton>
        </Items>
    </telerik:RadToolBar>

    JavaScript:
    <script type="text/javascript">
        function onClientButtonClicking(sender, args) {
            var radToolBar = $find("<%=RadToolBar.ClientID %>");
            var button = radToolBar.findItemByText("Exit");
            var ok = confirm("Are you sure you want to Exit?");
            if (ok)
                return true;
            else
                return args.set_cancel(true);
        }
    </script>

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top