Radwindow confirm button event is calling at page refresh?

3 posts, 0 answers
  1. Madhu Palakurthi
    Madhu Palakurthi avatar
    48 posts
    Member since:
    Nov 2009

    Posted 12 Dec 2012 Link to this post

    Hi,

    I have done Radwindow confirm example by following this link :
    Using A Custom RadWindow And Its ContentTemplate

    <telerik:RadWindowManager runat="server" ID="RadWindowManager1">
        <Windows>
            <telerik:RadWindow ID="rw_customConfirm" Modal="true" Behaviors="Close, Move" VisibleStatusbar="false"
                Width="300px" Height="200px" runat="server">
                <ContentTemplate>
                    <div class="rwDialogPopup radconfirm">
                        <div class="rwDialogText">
                            <asp:Literal ID="confirmMessage" Text="" runat="server" />
                        </div>
                        <div>
                            <telerik:RadButton runat="server" ID="rbConfirm_OK" Text="OK" OnClick="rbConfirm_OK_Click">
                            </telerik:RadButton>
                            <telerik:RadButton runat="server" ID="rbConfirm_Cancel" Text="Cancel" OnClientClicked="closeCustomConfirm">
                            </telerik:RadButton>
                        </div>
                    </div>
                </ContentTemplate>
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>
    <asp:Button ID="Button4" Text="call the RadConfirm" OnClick="Button4_Click" runat="server" />
    <script type="text/javascript">
        function closeCustomConfirm()
        {
            $find("<%=rw_customConfirm.ClientID %>").close();
        }
    </script>

    It''s working fine. but rbConfirm_OK_Click event is calling at page refresh also.. I want call this event only once that is click on confirm button (OK).. Please help me to solve this..

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4758 posts

    Posted 13 Dec 2012 Link to this post

    Hello Narsa,

    If the page has been posted to the server a page refresh will show a browser popup that asks whether the refresh should be cancelled or the data sent again. Of course, submitting the form the same way will result in the code-behind thinking the button was clicked and thus it will execute the server handler. You cannot override this browser behavior,yet you can reproduce it with the following simple markup that is the essence of the issue:
    <asp:Button ID="Button1" Text="postback" OnClick="rbConfirm_OK_Click" runat="server" />
    <asp:Button ID="Button2" Text="reload the page" OnClientClick="window.location.reload();" runat="server" />



    Regards,
    Marin Bratanov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. Pranitha Jugge
    Pranitha Jugge avatar
    2 posts
    Member since:
    Mar 2019

    Posted 25 Mar Link to this post

    Hi,

    I am facing the same issue. I tried using window.location.reload but it still executes button click event.

    Can you please provide me any other solutions. 

Back to Top