Monday, March 26, 2012

ConfirmButtonExtender does not validate prior to

Hi

I've got a scenario where we're using ConfirmButtonExtender on a button which needs to fire client-side validation prior to displaying the confirmation dialog (we're actually using a ModalPopExtender but have tried without). What's happening is that the confirmation dialog is showing but client-side validation is not firing until the user clicks OK in the popup. I've set ConfirmOnFormSubmit to True but it's not having the desired effect.

Another strange thing is that our ValidationSummary has ShowMessageBox enabled, but the popup that this normally shows is no longer being displayed, only the "*" next to each field on the form is. We're using an UpdatePanel on the page with all the above controls within it. The event handler for the confirm button click (the button assigned to ConfirmButtonExtender.TargetControlID) is calling Page.Validate and testing Page.IsValid during the asynch postback.

I suspect that I'm not quite using this combination of controls in the correct manner so any pointers most gratefully received.

Thanks

Ben

I've also had problems with this control when used on a button in a gridview. I know there was bug with it, just wondered if its been fixed.

My Page directives:

EnableEventValidation="false"AutoEventWireup="false"

<asp:GridViewID="dgDiets"runat="server"DataKeyNames="Pathway group code,Pathway type code"AutoGenerateColumns="False">

<Columns>

<asp:BoundFieldDataField="Pathway group code"HeaderText="Pathway group code"Visible="false"/>

<asp:BoundFieldDataField="Pathway type code"HeaderText="Pathway type code" />

<asp:BoundFieldDataField="Status"HeaderText="Status"/>

<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="btnDelete" CommandArgument="<%# Container.DataItemIndex %>" CommandName="DeleteRow" runat="server" Text="Delete" />
<cc1:ConfirmButtonExtender ID="ConfirmBtExt1"
runat="server" TargetControlID="btnDelete"
ConfirmText="Are you sure about deleting this record?" />
</ItemTemplate>
</asp:TemplateField>

</Columns>

<asp:GridView>

The following method should, but is not called when user clicks on ok popup:

Protected Sub dgDiets_OnRowCommand(ByVal etc, e as Sys.Web.UI.Webctrls.GridViewCommandEventArgs) Handles dgDiets.RowCommand

I'm sure this works on my home PC, but not at my work PC. However the code is identical. Anybody ever resolve this?

Thanks


Hi Egdif,

Egdif:

I've got a scenario where we're using ConfirmButtonExtender on a button which needs to fire client-side validation prior to displaying the confirmation dialog (we're actually using a ModalPopExtender but have tried without). What's happening is that the confirmation dialog is showing but client-side validation is not firing until the user clicks OK in the popup. I've set ConfirmOnFormSubmit to True but it's not having the desired effect.

Yes , the ConfirmButtonExtender will be shown when the associated Button is clicked. And the form is not going to be posted unless we click the ok button.Validators only work when the post is posting. So that's the problem.

Egdif:

Another strange thing is that our ValidationSummary has ShowMessageBox enabled, but the popup that this normally shows is no longer being displayed, only the "*" next to each field on the form is. We're using an UpdatePanel on the page with all the above controls within it. The event handler for the confirm button click (the button assigned to ConfirmButtonExtender.TargetControlID) is calling Page.Validate and testing Page.IsValid during the asynch postback.

I don't think you need to display another alert window. However, if you want to get the solution for your situation, we really need your source code.

I hope this help.

Best regards,

Jonathan

No comments:

Post a Comment