Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Modal Popup Extender Not Working on Postback

$
0
0

Hi,

I have a modal popup extender control which when I click submit on my button a pop up div control with a confirm or cancel button appears. When the page is loaded initially this works fine.

However I also have a couple of textbox controls which have their autopostback property set to true so that when text is entered the TextChanged event is called. Once this event has been called the next time I go to click the submit button the modal popup extender no longer works. My code is below:

<ajaxToolkit:ModalPopupExtender ID="modalPopupConfirm" runat="server" BehaviorID="mdlPopup"
        CancelControlID="btnConfirmNo" OkControlID="btnConfirmOk" OnCancelScript="cancelClick();"
        OnOkScript="okClick();" PopupControlID="divConfirmDelete" TargetControlID="divConfirmDelete" /><div id="divConfirmDelete" runat="server" align="center" class="modalPopUp">
        Are you sure you want to submit the time log?<p /><asp:Button ID="btnConfirmOk" runat="server" Text="Yes" Width="25px" /><asp:Button ID="btnConfirmNo" runat="server" Text="No" Width="25px" /></div><asp:Button ID="btnSubmit" runat="server" Text="Submit Time Log" OnClick="btnSubmit_Click" OnClientClick="showConfirm(this); return false;" CausesValidation="false" />
//Modal Popup
//  keeps track of the delete button for the row
//  that is going to be removed
var _source;
// keep track of the popup div
var _popup;

function showConfirm(source) {
    this._source = source;
    this._popup = $find('mdlPopup');

    //  find the confirm ModalPopup and show it
    this._popup.show();
}

function okClick() {
    //  find the confirm ModalPopup and hide it
    this._popup.hide();
    //  use the cached button as the postback source
    __doPostBack(this._source.name, '');
}

function cancelClick() {
    //  find the confirm ModalPopup and hide it
    this._popup.hide();
    //  clear the event source
    this._source = null;
    this._popup = null;
}

I'm really stuck as to how to have the modal popup extender retain it's functionality once a postback has occurred, any help would be greatly appreciated.

Thanks,
Daniel


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>