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

UpdatePanel doesn't work after using ModalPopupExtender and validation control

$
0
0

I have found out a problem with UpdatePanel when using asp.net validation control and Ajax toolkit ModalPopupExtender  control.

After RequiredFieldValidator and ModalPopupExtender are showed, the postback event in UpdatePanel will not be fired when I select a drop down list which was set autopostback=true before. You can try these lines of code below.

Click on Show button and then try selecting a value from the drop down list, the post back will not be rasied inside UpdatePanel

 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1"  %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><title></title></head><body><form id="form1" runat="server"><asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager><div><asp:UpdatePanel runat="server" ID="updateTest"  UpdateMode="Conditional"  ><ContentTemplate><asp:DropDownList runat="server" ID="ddlProvince" AutoPostBack="true"
                onselectedindexchanged="ddlProvince_SelectedIndexChanged"><asp:ListItem Text="HN" Value="HN"></asp:ListItem><asp:ListItem Text="BN" Value="BN"></asp:ListItem></asp:DropDownList><br /><asp:Label runat="server" ID="lblSelectedProvince"></asp:Label><br /><asp:TextBox runat="server" ID="txtName"></asp:TextBox><br /><asp:Button ID="fakeHidden" runat="server" Text="Show" /><ajaxToolkit:ModalPopupExtender ID="popupErrMsg" runat="server" TargetControlID="fakeHidden"
                        PopupControlID="SummaryDiv" BackgroundCssClass="modalBg" CancelControlID="btnOk" /><div id="SummaryDiv" class="popupdiv" style="display: none; border:1px solid black"><asp:Button CssClass="DefaultButton" ID="btnOk" runat="server" Text="Close" CausesValidation="false" /></div><asp:RequiredFieldValidator SetFocusOnError="true" ID="ValidatorBillingFirstNameRequired"
            Display="None" runat="server" ControlToValidate="txtName" /></ContentTemplate></asp:UpdatePanel></div></form></body></html>

Could some one help me to resolve this problem? I spent lots of time on investigating but haven't resolved it yet.

Note that, My application needs to place the model popup control inside the UpdatePanel for dynamic content reason so it cannot move to outside.

Thanks


Viewing all articles
Browse latest Browse all 5678

Trending Articles



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