简体   繁体   English

隐藏在Page_Load上的弹出式聊天框,是否不会再次出现在另一页的PageInit上?

[英]Hiding a popup Chat box on Page_Load, Doesn't re-appear on PageInit of another page?

I'll try and explain this as best as I can. 我会尽力解释这一点。

I've got a PopUp live chat box which is displayed via PageInit on every page via ASP.NET Master pages. 我有一个PopUp实时聊天框,该对话框通过PageInit在ASP.NET母版页的每个页面上显示。 When I hide the popup box from showing via PageLoad on a certain page's code behind, it will then not reappear on other pages despite having it set to show on the master page's PageInit. 当我隐藏弹出框以免通过PageLoad在特定页面的代码后面显示时,尽管将其设置为显示在母版页的PageInit上,但该弹出框将不会再出现在其他页面上。

Master Page: 母版页:

    public bool ShowLiveChat { get; set; }

    protected override void OnInit(EventArgs e)
    {
        ShowLiveChat = true;
    }

Code Behind of concerned page: 有关页面后面的代码:

    protected void Page_Load(object sender, EventArgs e)
    {
        ((CommonHeaderAndFooter)Master).ShowLiveChat = false;
    }

public bool ShowLiveChat { get; set; } public bool ShowLiveChat { get; set; } is global object here. public bool ShowLiveChat { get; set; }是全局对象。 After initializing on the master page, it is getting Loaded on concerned page where its visibility is set to false which also affects on master page and that's why you are not able to see it on any page. 在母版页上初始化后,它会在相关页面上加载,其可见性设置为false,这也会在母版页上影响,这就是为什么您无法在任何页面上看到它。

Check the ASP.NET Page Life Cycle Overview 检查ASP.NET页面生命周期概述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM