ModalPopupExtender non ripristina l'opacità

martedì 09 marzo 2010 - 22.19

venzo Profilo | Junior Member

Ho una pagina che mi sta dando i nervi. Quando richiamo un Panel tramite ModalPopupExtender, mi crea lo sfondo opaco.
Quando premo cancel del Panel, tutto ok; quando invece premo il bottone Salva, che richiama un semplice ModalPopupExtender.Hide(), chiude il Panel ma non rispristina lo sfondo, lasciando l'opacità.
Non ho bisogno di riportarvi il codice, visto che ho usato un codice già presente in un altra pagina e funziona.
Come mai ?
Ho verificato che inserendo il tutto sotto un unico updatepanel funziona.
Invece il mio codice è stratturato così:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Phones.aspx.cs" Inherits="Phones" MasterPageFile="~/Default.master" %>
<%@ MasterType VirtualPath="~/Default.master" %>

<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="BodyContent">
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server" />
<asp:SqlDataSource ID="dsPhone" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [PersonPhoneID], [PersonId], [PhoneNumber], [Extension] FROM [PersonPhone]" DeleteCommand="DELETE FROM [PersonPhone] WHERE [PersonPhoneId] = @PersonPhoneID" InsertCommand="INSERT INTO [PersonPhone] ([PersonId], [PhoneNumber], [Extension]) VALUES (@PersonId, @PhoneNumber, @Extension)" UpdateCommand="UPDATE [PersonPhone] SET [PhoneNumber] = @PhoneNumber, [Extension] = @Extension WHERE [PersonPhoneID] = @PersonPhoneID">
<DeleteParameters>
<asp:Parameter Name="PersonPhoneID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="PersonId" Type="Int32" />
<asp:Parameter Name="PhoneNumber" Type="String" />
<asp:Parameter Name="Extension" Type="String" />
<asp:Parameter Name="PersonPhoneID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="PersonId" Type="Int32" />
<asp:Parameter Name="PhoneNumber" Type="String" />
<asp:Parameter Name="Extension" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
<asp:XmlDataSource ID="dsPhoneXml" runat="server" DataFile="~/App_Data/Data.xml" XPath="/Data/PhoneTable/Phone"></asp:XmlDataSource>




<asp:UpdatePanel ID="updPhone" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="grdPhone" EventName="Sorting" />
</Triggers>
<ContentTemplate>






<asp:GridView ID="grdPhone" runat="server" AutoGenerateColumns="False" DataSourceID="dsPhoneXml" AllowSorting="True" OnRowDataBound="editGrid_RowDataBound" Caption="Phones">
<Columns>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:ImageButton ID="btnEdit" runat="server" SkinID="GridEditButton" OnClick="btnEditPhone_Click" CausesValidation="false" />
<asp:ImageButton ID="btnDelete" runat="server" SkinID="GridDeleteButton" OnClick="btnDeletePhone_Click" OnClientClick="javascript:return confirm('Are you sure you want to delete this row?');" CausesValidation="false" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="PersonPhoneID" HeaderText="PersonPhoneID" SortExpression="PersonPhoneID" />
<asp:BoundField DataField="PersonID" HeaderText="PersonID" SortExpression="PersonID" />
<asp:BoundField DataField="PhoneNumber" HeaderText="PhoneNumber" SortExpression="PhoneNumber" />
<asp:BoundField DataField="Extension" HeaderText="Extension" SortExpression="Extension" />
</Columns>
</asp:GridView>





<!--cheesy button for the modal popups target control-->
<asp:Button ID="btnHiddenPhone" runat="Server" Style="display: none" />

<ajaxToolKit:ModalPopupExtender
ID="mpePhone"
runat="server"
TargetControlID="btnHiddenPhone"
PopupControlID="pnlPhone"
CancelControlID="btnCancelPhone"
BackgroundCssClass="modalBackground"
PopupDragHandleControlID="PhoneCaption"
Drag="true">
</ajaxToolKit:ModalPopupExtender>


</ContentTemplate>
</asp:UpdatePanel>


<asp:Panel ID="pnlPhone" runat="server" CssClass="modalBox" Style="display: none;" Width="400px">
<asp:Panel ID="PhoneCaption" runat="server" CssClass="caption" Style="margin-bottom: 10px; cursor: hand;">
Edit Phone</asp:Panel>
<asp:HiddenField ID="hidPhoneEditIndex" runat="server" Value="-1" />
<asp:UpdatePanel ID="update2" runat="server" UpdateMode="Conditional">
<div class="divCol">
Phone Number</div>
<div class="divColLast">
<uCtl:Phone ID="Phone1" runat="server"></uCtl:Phone>
</div>
<div class="clearer">
</div>
<div style="white-space: nowrap; text-align: center;">
<asp:Button ID="btnSavePhone" runat="server" Text="Save" OnClick="btnSavePhone_Click" />
<asp:Button ID="btnCancelPhone" runat="server" CausesValidation="false" Text="Cancel" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
</asp:Content>
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2017
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5