Hide modal while performing a partial postback inside a ajaxpanel?

2 posts, 0 answers
  1. DH
    DH avatar
    11 posts
    Member since:
    Dec 2011

    Posted 27 May 2014 Link to this post

    I have a modal that gets dynamically loaded when a user clicks a button on a grid. The modal content is populated from an ascx user control. It has to be inside the update panel as the values change dynamically when the user clicks the grid.

    I add the following to display the modal:

    Me.LoadMyUserControl("~/controls/Log.ascx", Panel1)
    Dim MessageScript As String = "$('#modal-interact').modal('toggle');"
    ScriptManager.RegisterStartupScript(Me, GetType(Page), "UniqueID1", MessageScript, True)


    The problem is, when i submit the modal since the modal is ajax-y it does a partial postback causing the modal not to close.

    I've tried using an onclientclick to close the modal then postback via javascript but the postback does not occur. 

    This will close the modal, but not fire the postback:

    <script type="text/javascript">
        function confirmthis()
        {
            $('#modal-interact').modal('hide');
            return true;
    }
        </script>

    Then of course removing the onclientclick and just handling the onclick triggers the postback, but does not hide the modal. 
  2. Radoslav
    Admin
    Radoslav avatar
    1564 posts

    Posted 30 May 2014 Link to this post

    Hi Dan,

    To achieve the desired functionality you can try using the RadAjaxManager or RadAjaxPanel. Then you can handle the ClientEvents-OnRequestStart event and hide the modal . For example:
    <telerik:RadCodeBlock runat="server">
            <script type="text/javascript">
                function OnRequestStart(sender, eventArgs)
                {
                    // hide the modal
                }
            </script>
        </telerik:RadCodeBlock>
    <telerik:RadAjaxPanel ClientEvents-OnRequestStart="OnRequestStart" ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">

    I hope this helps.

    Regards,
    Radoslav
    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
Back to Top