Sunday, March 11, 2012

Dropdown Controls not available after ModalPopup closed

Please try your scenario with the recently available10123 release of the Toolkit (andASP.NET AJAX 1.0). If the problem persists, then please reply with acomplete, simple, self-contained sample page that demonstrates the problem so that we can investigate the specific behavior you're seeing. Thank you!

Hello,

i'm currently working with the latest version of the control toolkit and ASP.NET AJAX 1.0. I have attached a simple web page with the behavior in IE 6.0:

<%@. Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Sample Modal Dialog Extender and DropDown Controls</title> <style> .textCSS { background-color:Gray; filter:alpha(opacity=70); opacity:0.7; } </style> <script language="javascript"> function OnClose() { alert("Dialog closed."); } </script></head><body> <form id="form1" runat="server" defaultbutton=""> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <div> <asp:DropDownList ID="ddSample" runat="server"> <asp:ListItem Selected="True">Entry 1</asp:ListItem> <asp:ListItem>Entry 2</asp:ListItem> </asp:DropDownList> <br /> <asp:Button runat="server" Text="Open Dialog" ID="btnOpenDialog" UseSubmitBehavior="true" /> </div> <asp:Panel ID="DialogPanel" runat="server" BackColor="yellow" style="display: none;"> Please press enter and close the dialog with the OK Button.<br /> <asp:Label ID="lblTextbox1" runat="server" Text="Textbox 1:"></asp:Label> <asp:TextBox ID="txtBox1" runat="server" Text=""></asp:TextBox> <br /> <asp:Label ID="lblTextbox2" runat="server" Text="Textbox 2:"></asp:Label> <asp:TextBox ID="txtBox2" runat="server" Text=""></asp:TextBox> <br /> <asp:Button ID="btnClose" CausesValidation="false" runat="server" Text="Close" /> <asp:Button ID="btnOk" CausesValidation="false" runat="server" Text="OK" /> </asp:Panel> <ajax:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnOpenDialog" PopupControlID="DialogPanel" CancelControlID="btnClose" BackgroundCssClass="textCSS" OnOkScript="OnClose()" OkControlID="btnOk" > </ajax:ModalPopupExtender> </form></body></html>

Codebehind:

using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;public partialclass _Default : System.Web.UI.Page {protected void Page_Load(object sender, EventArgs e) { }}
Web.config:
<configuration><configSections><sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"><sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"><section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/><sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"><section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/><section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/><section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/></sectionGroup></sectionGroup></sectionGroup></configSections><system.web> <pages><controls><add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/></controls></pages><!-- Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development. --><compilation debug="true"><assemblies><add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/><add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/><add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></assemblies></compilation><httpHandlers><remove verb="*" path="*.asmx"/><add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/><add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/><add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/></httpHandlers><httpModules><add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/></httpModules></system.web><system.web.extensions><scripting><webServices><!-- Uncomment this line to customize maxJsonLength and add a custom converter --><!-- <jsonSerialization maxJsonLength="500"> <converters> <add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/> </converters> </jsonSerialization> --><!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. --><!-- <authenticationService enabled="true" requireSSL = "true|false"/> --><!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and writeAccessProperties attributes. --><!-- <profileService enabled="true" readAccessProperties="propertyname1,propertyname2" writeAccessProperties="propertyname1,propertyname2" /> --></webServices><!-- <scriptResourceHandler enableCompression="true" enableCaching="true" /> --></scripting></system.web.extensions><system.webServer><validation validateIntegratedModeConfiguration="false"/><modules><add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/></modules><handlers><remove name="WebServiceHandlerFactory-Integrated"/><add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/><add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/><add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/></handlers></system.webServer></configuration>
 
Regards
Marc Andre

I could reproduce the problem. Thanks for providing the snippet. I have opened work item 7851 in the toolkit issue tracker and we will investigate possible fixes.

http://www.codeplex.com/AtlasControlToolkit/WorkItem/View.aspx?WorkItemId=7851


I have just checked a fix for this problem in to the Development branch of the Toolkit as change 24425 for the next release:

ModalPopup users who had a ModalPopup inside an UpdatePanel and who were dismissing the UpdatePanel via an async postback from within that UpdatePanel noted that *on IE6 only* the SELECT elements on the page (which the ModalPopup had hidden to work around an IE6 display bug with SELECTs) were not made visible again when the ModalPopup went away. The fix turns out to be simple: in ModalPopup's dispose method, it now calls its restoreTabs method to fix up the changes it made to the page when displaying itself (and restoreTabs has been made safe to call multiple times in a row because it clears the two internal arrays after processing them). This fixes the problem sceniaro because ASP.NET AJAX automatically disposes any extenders in an UpdatePanel that is being repopulated by an async postback. Note that it's also still fine to put an UpdatePanel *within* a ModalPopup's PopupControlID Panel because that scenario doesn't tear down the ModalPopup and the SELECTs remain hidden as they should be until the ModalPopup is hidden.

No comments:

Post a Comment