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

Radwindow confirm button event is calling at page refresh?

2 Answers 100 Views
Window
This is a migrated thread and some comments may be shown as answers.
Madhu Palakurthi
Top achievements
Rank 1
Madhu Palakurthi asked on 12 Dec 2012, 06:32 AM
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 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 13 Dec 2012, 01:49 PM
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.
0
Pranitha Jugge
Top achievements
Rank 1
answered on 25 Mar 2019, 02:39 PM

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. 

Tags
Window
Asked by
Madhu Palakurthi
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Pranitha Jugge
Top achievements
Rank 1
Share this question
or