2014-11-06 84 views
0

我對母版頁驗證碼:如何禁用某些頁面的UpdateProgress(在母版頁上)?

<asp:ScriptManager ID="ScriptManager1" runat="server"> 
</asp:ScriptManager> 
<asp:UpdateProgress ID="updateProgress" runat="server"> 
    <ProgressTemplate> 
     <div id="aspProgressDiv" style="position: fixed; text-align: center; height: 100%; width: 100%; top: 0; 
      right: 0; left: 0; z-index: 9999999; background-color: #000000; opacity: 0.7;"> 
      <asp:Image ID="imgUpdateProgress" runat="server" ImageUrl="Images/ajax-loader.gif" 
       AlternateText="Loading ..." ToolTip="Loading ..." Style="padding: 10px; position: fixed; 
       top: 45%; left: 50%;" /> 
     </div> 
    </ProgressTemplate> 
</asp:UpdateProgress> 

而且對我有自動觸發事件,並刷新該頁面的計時器的一個頁面。

​​

而在C#中,我有:

protected void Page_Load(object sender, EventArgs e) 
{ 
    try 
    {    
      if (!Page.IsPostBack) 
      { 
       timerRefresh_Tick(null, null); 
      } 

    } 
    catch (Exception exception) 
    { 
    } 

} 
protected void chkAutoRefresh_CheckedChanged(object sender, EventArgs e) 
{ 
    try 
    { 
     timerRefresh.Enabled = chkAutoRefresh.Checked; 
    } 
    catch (Exception exception) 
    { 

    } 
} 

protected void timerRefresh_Tick(object sender, EventArgs e) 
{ 
    try 
    { 
     //post data to page 
    } 
    catch (Exception exception) 
    { 
     //Do something 
    } 
} 

我想,這個頁面的UpdateProgress不應該工作,應該對所有異步事件的所有頁面上工作。 我可以並處像一個條件:

if(pageName=="abc.aspx"){ 
    //dont show progressbar 
} 

或任何其他的選擇嗎?

回答

0

您可以嘗試在你的母版頁添加一個虛擬的更新面板,像這樣:

<asp:UpdatePanel runat="server" ID="upDummy"></asp:UpdatePanel> 

然後在你的內容頁面加載事件時,UpdateProgress關聯到虛更新面板,就像這樣:

CType(Me.Master.FindControl("UpdateProgress1"), UpdateProgress).AssociatedUpdatePanelID = 
    CType(Me.Master.FindControl("upDummy"), UpdatePanel).ID 
相關問題