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

ModalPopupExtender triggering Client Side Validation

$
0
0

Hi,

I have a modal popup extender which is triggered when a link button is clicked, code 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 timesheet?<asp:Button ID="btnConfirmOk" runat="server" Text="Yes" /><asp:Button ID="btnConfirmNo" runat="server" Text="No" /></div>
<asp:LinkButton 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 also have a validation summary control and list view control on the page which contains various validation controls. The list view also has a couple of cascasding drop down controls, validation summary below:

<asp:ValidationSummary ID="valSum" runat="server" EnableClientScript="true" HeaderText="Please correct the following errors:" ValidationGroup="valInsert" />

The modal popup displays when I click btnSubmit however when I click btnConfirmOk instead of carrying on to the btnSubmit_Click event the client side validation I have stored in the list view is activated (validation group "valInsert" are used on the validation controls in the list view). It is only on the second attempt of clicking btnSubmit (this time no popup appears) is the btnSubmit_Click triggered. The same is also true if I populate all the controls to be valid so the client side validation is not triggered it still takes two clicks in order to activate btnSubmit_Click.

I'm really not sure where I am going wrong and 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>