在计时器刻度事件中面板可见性不会改变

时间:2014-07-09 14:26:08

标签: c# asp.net timer

我正在使用aspx网页,其中放置了两个updatepanel。在内部Updatepanel中,启用了计时器触发器,并且在该计时器刻度事件中,我想在特定条件下使面板可见。但不幸的是,专家小组的知名度没有改变。我的代码如下: -

protected void ChatTextTimer_Tick(object sender, EventArgs e)
{
    //if (!worker1.IsBusy)
    //{
    //    worker1.RunWorkerAsync();
    //}
    if (lblHired.Text == "Hiring")
    {
        con.Open();
        if (Label3.Text == "Approved")
        {
            UpdatePanel2.ChildrenAsTriggers = false;

            lblHired.Text = "Hired";
            Panel3.Visible = false;
        }
     }

我的aspx代码如下: -

<asp:UpdatePanel ID="UpdatePanel2" runat="server"  UpdateMode="Conditional">
    <ContentTemplate>

        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">                
            <ContentTemplate>                                         
                <asp:TextBox ID="TxtBox1" runat="server" TextMode="MultiLine" ReadOnly="True" width="100%" Height="250px" AutoPostBack="False" style="margin-left:10px;resize:none;font-family:Times New Roman;font-size:14px;" MaintainScrollPositionOnPostBack="True" ></asp:TextBox>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="SendButton" EventName="Click" />
                <asp:AsyncPostBackTrigger ControlID="ChatTextTimer" EventName="Tick" />
            </Triggers>
        </asp:UpdatePanel>  

        <asp:Panel ID="Panel3" Visible="false" runat="server" style="height: 160px; position: absolute; width: 339px; opacity: 1; background-color: rgb(255, 255, 126); border: 1px solid rgb(51, 51, 51); border-radius: 15px; padding: 46spx 16px 38px 14px; left: 20px;top:20px;">

            <div>
                <br />
                <br />
                <br />
                <asp:Image ID="Image3" runat="server" ImageUrl="~/loading.gif" style="margin-left:151px;" />

                <br />
                <br />
            </div>

        </asp:Panel>
    </ContentTemplate>
</asp:UpdatePanel>

0 个答案:

没有答案