Vince,
There are two update panels, basically one has "properties" in it (pnlPropsU), and the other contains the "fields" that the properties can be set for (upDesign).
When in use, I click on a field, which triggers the properties of that field to be loaded into pnlPropsU. When I change a value in pnlPropsU, those changes should be reflected in upDesign. Now, all this WORKS, when the modalPopupExtender is turned off, but when it is turned on, it works for when pnlPropsU is doing the async postback, but when upDesign is doing the async postback, it fails on the mdlProgress hide method - as if the modalPopupExtender has been removed entirely during the async postback on that updatepanel.
So my updatepanels are like so:
<
div id="properties">
<cc1:CollapsiblePanelExtender ID="cpl3" runat="server" TargetControlID="pnlProps"
CollapsedSize="0"
Collapsed="True"
ExpandControlID="lblProps"
CollapseControlID="lblProps"
TextLabelID="lblProps"
CollapsedText=" Field Properties (Show Details)"ExpandedText=" Field Properties (Hide Details)"
ImageControlID="imgProps"
ExpandedImage="images/collapse.jpg"
CollapsedImage="images/expand.jpg" Enabled="True"
>
</cc1:CollapsiblePanelExtender>
<div id="divPropsHeader" class="cplHeader">
<asp:Image ID="imgProps" runat="server" />
<asp:Label ID="lblProps" runat="server"></asp:Label>
</div>
<asp:Panel runat="server" id="pnlProps" CssClass="cplContent">
<asp:UpdatePanel ID="pnlPropsU" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<cc1:TabContainer ID="tabProps" runat="server" ActiveTabIndex="0" EnableViewState="true" >
<cc1:TabPanel ID="tabPropsSettings" runat="server" HeaderText="Settings">
<HeaderTemplate>
Field Settings
</HeaderTemplate>
<ContentTemplate>
<asp:PlaceHolder ID="pnlUpdateSettingsProps" runat="server">
<div id="pnlUpdateSettingsBlankHolder" runat="server" style="height:250px;vertical-align:middle;text-align:center;">
<p>Please select a field to view its settings</p>
</div>
</asp:PlaceHolder>
<div style="margin-top:15px;"></div>
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID="tabPropsStyle" runat="server" HeaderText="Style">
<HeaderTemplate>
Field Appearance
</HeaderTemplate>
<ContentTemplate>
<asp:PlaceHolder ID="pnlUpdateStyleProps" runat="server"></asp:PlaceHolder>
<div style="margin-top:15px;"></div>
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer>
<div id="refreshButton">
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="hdfEditTS" EventName="ValueChanged" />
</Triggers>
</asp:UpdatePanel>
</asp:Panel>
<div id="divPropsFooter" class="cplFooter">
</div>
</div>
</div>
<asp:Panel ID="CssContainer" runat="server">
<div id="dropArea_0" class="dropArea" runat="server">
<asp:UpdatePanel runat="server" ID="upDesign" UpdateMode="Conditional">
<ContentTemplate>
<asp:PlaceHolder runat="server" ID="myPlaceHolder">
</asp:PlaceHolder>
<asp:Literal ID="LitScripts" runat="Server" Enableviewstate="false" Mode="PassThrough">
</asp:Literal>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="hdfUpdate" EventName="ValueChanged" />
</Triggers></asp:UpdatePanel> <div runat="server" id="dropArea_0_handleRight" style="width:3px;
top:0px;cursor:e-resize;position:absolute;"
class="handleRightDA" onmouseover="colourResize(this);" onmouseleave="colourResizeRemove(this);" >
</div><div runat="server" id="dropArea_0_handleCorner" style="width:3px;
height:3px;cursor:se-resize;position:absolute;"
class="handleCornerDA" onmouseover="colourResize(this);" onmouseleave="colourResizeRemove(this);" >
</div><div runat="server" id="dropArea_0_handleBottom" style="height:3px;
left:0px;cursor:s-resize;position:absolute;"
class="handleBottomDA" onmouseover="colourResize(this);" onmouseleave="colourResizeRemove(this);">
</div>
</div>
</asp:Panel>
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer>
The update panel is created outside of all of this as follows:
<
asp:Panel ID="pnlProgress" runat="server" CssClass="modalPopup" Style="display: none" Width="255px">
<div class="popupControl">
<div align="center">
<p>Updating...</p>
<img src="/images/progress.gif" border="0" alt="Updating..." />
</div>
</div>
</asp:Panel><cc1:ModalPopupExtender ID="mdlProg" runat="server" BehaviorID="mdlProg"
TargetControlID="pnlProgress"
PopupControlID="pnlProgress"
BackgroundCssClass="modalBackground"
/>
My code-behind for when the ValueChanged triggers are fired, are as so, they just call other methods that add controls to the placeholders, or set values in textboxes:
protected void hdfEditTS_ValueChanged(object sender, EventArgs e)
{
loadProperties();
}
protected void hdfUpdate_ValueChanged(object sender, EventArgs e)
{
startRender();
}
To trigger this, I use javascript events that are fired from within attached events to boxes etc:
e.g:
$find(
"tabContents_tabDesign_cpl2").set_Collapsed(true); $find("tabContents_tabDesign_cpl3").set_Collapsed(false);
document.getElementById(
"hdfEditID").setAttribute("value",id);document.getElementById("hdfEditTS").setAttribute("value",d.getHours()+d.getMinutes()+d.getSeconds+d.getMilliseconds());
__doPostBack('hdfEditTS','Editing');
Now, this works fine for the modal popup being triggered for the async postback on items loaded into pnlPropsU, but if I try and do it on upDesign, as such:
document.getElementById("hdfUpdate").setAttribute("value","0");
document.getElementById(
"hdfUpdate").setAttribute("value",element.id+element.value);DynForms.DBAccess.InsertField(_formID,sElement,sObjType,element.style.width,element.style.height,diffX+"px",diffY+"px",sObjID,sSecID,sLabelPos,sHeight,sWidth,onGetDataComplete, onGetDataTimeOut);
var id = setTimeout(function(){__doPostBack('hdfUpdate','ValueChanged')},1000); //note, I have tried this without the timeout as well, this is just her because on VPN I get DB lag.
As soon as ANYTHING changes in hdfUpdate, i.e. the ValueChanged trigger occurs, the modal popup shows, the database is written to OK, the value in hdfUpdate is written to, but then the modalpopup cannot be found to be removed.
I'm sure I posted it earlier, but I am using the following to register the async events to show/hide the modalpop:
// register for our events
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequest);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequest);
function beginRequest(sender, args){
// show the popup$find('mdlProg').show();
}
function endRequest(sender, args) {
// hide the popup$find('mdlProg').hide(); //THIS IS THE LINE THAT ERRORS - The modal cannot be found, but only during hdfUpdate having it's value changed....
}
I have ensured that it's not the code behind that is throwing the problem, as I have commented out everything that it does in the loadProperties, and startRender methods, just to make sure.
If you need any more information -please let me know, and THANKYOU! for your help.
James.
If this answered your question, please mark as an answer so others will know too.
http://wyerarch.blogspot.com