RadConfirm not shown

3 posts, 1 answers
  1. Dimitrios
    Dimitrios avatar
    45 posts
    Member since:
    Jun 2014

    Posted 06 Oct 2014 Link to this post

    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. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    3596 posts

    Posted 06 Oct 2014 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Dimitrios
    Dimitrios avatar
    45 posts
    Member since:
    Jun 2014

    Posted 07 Oct 2014 in reply to Marin Bratanov Link to this post

    Thank you Marin,

    Now it works fine...
Back to Top