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

RadConfirm not shown

2 Answers 102 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dimitrios
Top achievements
Rank 1
Dimitrios asked on 06 Oct 2014, 08:55 AM
Hello all,

I have:

in .aspx
 <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true">
          </telerik:RadWindowManager>
  <script type="text/javascript">
    function confirmCallbackFn(arg) {
      if (arg) { //the user clicked OK
      __doPostBack("<%=HiddenButton.UniqueID %>", "");
      }
    }

    </script>
 
<div id="divMain" style="position: relative; top: 0px;">
<asp:Button ID="HiddenButton" Text="" OnClick="HiddenButton_Click"
  runat="server" Visible="False" />

....



in the code (inside a delete event of a radgrid)
RadWindowManager1.RadConfirm("Delete this Tender?", "confirmCallBackFn", 330, 180, Nothing, "Confirm")

...and

Protected Sub HiddenButton_Click(sender As Object, e As System.EventArgs) Handles HiddenButton.Click
...the actual code which deletes the Tender from the database
End Sub


While the RadConfirm does get executed, the radconfirm window is not appearing on the page.

Could you please point out my mistake?

Thanks






    


2 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 06 Oct 2014, 01:32 PM

Hi Dimitrios,

The hidden button should have Visible=true so it renders on the page and you can POST the page via the __doPostBack() call. Otherwise, you will get a server error about wrong event arguments when __doPostBack() executes.

The problem with the RadConfirm is that the casing for the callback function is incorrect, so a JavaScript error is thrown. Here is a sample that should work fine:

<telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true">
</telerik:RadWindowManager>
<asp:Button ID="Button1" Text="test button" OnClick="Button1_Click" runat="server" />
<div id="divMain" style="position: relative; top: 0px;">
    <asp:Button ID="HiddenButton" Text="" OnClick="HiddenButton_Click"
        runat="server" Visible="true" Style="display:none;" />
</div>
<script type="text/javascript">
    function confirmCallbackFn(arg) {
        if (arg) { //the user clicked OK
            __doPostBack("<%=HiddenButton.UniqueID %>", "");
        }
    }
</script>

Protected Sub HiddenButton_Click(sender As Object, e As System.EventArgs) Handles HiddenButton.Click
    Response.Write("the expected hidden button click handler was executed")
End Sub
 
Protected Sub Button1_Click(sender As Object, e As EventArgs)
    RadWindowManager1.RadConfirm("Delete this Tender?", "confirmCallbackFn", 330, 180, Nothing, "Confirm")
End Sub

where I have highlighted the key moments.

Regards,

Marin Bratanov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Dimitrios
Top achievements
Rank 1
answered on 07 Oct 2014, 05:30 AM
Thank you Marin,

Now it works fine...
Tags
General Discussions
Asked by
Dimitrios
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Dimitrios
Top achievements
Rank 1
Share this question
or