Asp .net链接按钮子控件在回发时消失
本文关键字:消失 控件 net 链接 按钮 Asp | 更新日期: 2023-09-27 18:18:49
我有一个asp .net超链接控件声明如下:
<li runat="server" id="liveChatCtrl" Visible="false"><asp:LinkButton runat="server" ID="hlnkLiveChat" CausesValidation="false" OnClick="hlnkLiveChat_Click">Live Chat Support <i class="icon icon_next_03 fr"></i><i runat="server" id="iconChat" class="icon_chat_online"></i></asp:LinkButton></li>
我的问题是链接按钮的内容在回发时消失。知道为什么会这样吗?
加载时,我在linkbutton或它的子按钮上执行以下代码:
string absoluteURL = UtilManager.Settings.Item(Utils.BrandID, "URL:absoluteURL");
string chatLink = "StartChat.aspx";
if (HttpContext.Current.User.Identity.IsAuthenticated)
chatLink = "LiveChat.aspx";//~/
//else
// chatLink = "SalesChat.aspx";
string link = absoluteURL + chatLink;
hlnkLiveChat.Attributes["onclick"] = string.Format("javascript:window.open( '{0}', 'chat', 'status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,height=505,width=420,left=30,top=30');", link);//"openPopup('" + link + "','chat'); return false;";
liveChatCtrl.Visible = true;
猜一猜…
我相信您的Page_Load
(或Init
)中的代码可能在if(!IsPostBack)
如果是这种情况,请将其移出if
语句,因为您需要它作为默认的visible
运行,因为您的liveChatCtrl
是false
或者重新编写一点代码,使默认的visible
为真,并在需要时运行回发检查以隐藏它