2009-10-13 5 views
0

updatepanel의 작업이 완료되었지만 updatepanel의 내용을 다시 렌더링하지 않고 진행 애니메이션을 표시하려고합니다.UpdatePanel 및 UpdatePanelAnimationExtender 문제

ChildrenAsTriggers = "false"로 설정하면 UpdatePanelAnimationExtender의 업데이트 된 스크립트가 트리거되지 않습니다 (onUpdated()).
ChildrenAsTriggers = "true"로 설정하고 div 표시 버튼을 클릭하면 업데이트가 완료된 후 updatepanel의 내용이 다시 렌더링되고 div가 다시 숨겨집니다.

내 코드 : 대신 UpdatePanelAnimationExtender으로 updatePanel를 확장

<head id="Head1" runat="server"> 
    <title>Untitled Page</title> 
    <script language="javascript" type="text/javascript"> 
     function ShowHide(){ 
      var div = document.getElementById('div2'); 
      if (div.style.display=="none") 
       div.style.display=""; 
      else 
       div.style.display="none"; 


     } 

      function onUpdating(){ 
       // get the update progress div 
       var pnlPopup = document.getElementById("div2");       

      } 

      function onUpdated() { 
       // get the update progress div 
       var pnlPopup = $get("div2"); 
       // make it invisible 

      }  

    </script> 
</head> 
<body> 
<form id="form11" runat="server"> 
    <asp:ScriptManager ID="ScriptManager1" runat="server"> 
    </asp:ScriptManager> 
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false"> 
     <ContentTemplate> 
     <input id="Button1" onclick="ShowHide();" type="button" value="Show Div (click first)" /> 
     <asp:Button ID="Button2" runat="server" Text="Button" OnClick="Click" /> 
&nbsp;<div id="div1" style="background-color:Red;width:700px;height:200px;"> </div>   
     <div id="div2" style="background-color:Blue;width:700px;height:500px;display:none;"></div> 
     </ContentTemplate> 
    </asp:UpdatePanel>  
    <cc1:UpdatePanelAnimationExtender ID="UpdatePanelAnimationExtender1" TargetControlID="UpdatePanel1" runat="server"> 
     <Animations> 
      <OnUpdating> 
       <Parallel duration="0" >   
        <ScriptAction Script="onUpdating();" /> 
       </Parallel> 
      </OnUpdating> 
      <OnUpdated> 
       <Parallel duration="0">    
       <ScriptAction Script="onUpdated();" /> 
       </Parallel> 
      </OnUpdated> 
     </Animations> 
    </cc1:UpdatePanelAnimationExtender> 

</form> 
</body> 

protected void Click(object sender, EventArgs e) 
    { 
     System.Threading.Thread.Sleep(3000); 
    } 

답변

0

나는 UpdatePanelAnimationExtender 또는 UpdateProgress없이 PageRequestManage를 사용하여 원하는 결과를 얻었습니다.

with (Sys.WebForms.PageRequestManager.getInstance()) { 
     add_beginRequest(onUpdating); 
     add_endRequest(onUpdated); 
    } 
0

사용 UpdateProgress 컨트롤.

<form id="form1" runat="server"> 
    <div> 
     <asp:ScriptManager ID="ScriptManager1" runat="server"> 
     </asp:ScriptManager> 

    </div> 
     <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> 
      <ContentTemplate> 
       <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br /> 
       <br /> 
       <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="click" /> 
      </ContentTemplate> 
      <Triggers> 
       <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" /> 
      </Triggers> 
     </asp:UpdatePanel> 
     <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1"> 
      <ProgressTemplate> 
       &nbsp;<img src="loading.jpg" /> 
      </ProgressTemplate> 
     </asp:UpdateProgress> 
    </form> 


using System; 
using System.Data; 
using System.Configuration; 
using System.Collections; 
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 partial class Default3 : System.Web.UI.Page 
{ 
    protected void Page_Load(object sender, EventArgs e) 
    { 

    } 
    protected void Button1_Click(object sender, EventArgs e) 
    { 
     System.Threading.Thread.Sleep(5000); 
    } 
} 
+0

왜 더 낫습니까? – dani

+0

스크립트 업데이트를 활성화해야합니다. 그것에는 약간의 계산과 위치가 있습니다. – dani

+0

을 확인한 후 전혀 작동하지 않습니다. 패널을 다시 렌더링 ... – dani

관련 문제