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

Hide modal while performing a partial postback inside a ajaxpanel?

1 Answer 84 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
DH
Top achievements
Rank 1
DH asked on 27 May 2014, 07:10 PM
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. 

1 Answer, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 30 May 2014, 10:48 AM
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.

 
Tags
Ajax
Asked by
DH
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Share this question
or