【问题标题】:ModalPopUpExtender makes popupcontrol invisibleModalPopUpExtender 使 popupcontrol 不可见
【发布时间】:2009-08-14 20:07:53
【问题描述】:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
    <link href="Styles.css" rel="stylesheet" type="text/css" />
</head>

<body>
    <form id="form1" runat="server">
    <asp:scriptmanager ID="sc1" runat="server"></asp:scriptmanager>

<asp:LinkButton ID="LinkButton1" runat="server" CssClass="links"
Visible="true">LinkButtonABCDEFGHIJKLMNOPQRSTUVWXYZ</asp:LinkButton>
<asp:Panel ID="Panel1" runat="server" Width="100%" Height="100%" style="display:none;">
  Display text.
</asp:Panel>
<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" 
   TargetControlID="Panel1" PopupControlID="LinkButton1">
</cc1:ModalPopupExtender>
</form>

这是我的代码。我在 IE8、chrome、Safari 和所有三个上都试过,因为页面加载时,LinkBut​​ton 就消失了。我在那里做错了吗?

【问题讨论】:

  • 随机数字块是怎么回事?
  • 那些只是body标签中的一些文字。

标签: modalpopupextender


【解决方案1】:

我不知道我是否记错了,但您的 TargetControlID 应该是您的 LinkBut​​ton,它应该会激活弹出窗口。有一些约定可以这样做。我阅读了《Asp.net Ajax in Action》一书,其中对其进行了描述。不幸的是我不记得为什么。您的 PopupControlID 应该是面板。

所以我猜它应该是这样的

<asp:LinkButton ID="LinkButton1" runat="server" CssClass="links"
Visible="true">LinkButtonABCDEFGHIJKLMNOPQRSTUVWXYZ</asp:LinkButton>

<asp:Panel ID="Panel1" runat="server" Width="100%" Height="100%" style="display:none;">
</asp:Panel>
<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" 
   TargetControlID="LinkButton1" PopupControlID="Panel1">
</cc1:ModalPopupExtender>

查看示例here

【讨论】:

    【解决方案2】:

    你想设置 PopupControlID="LinkBut​​ton1"

    顺便说一句,您的面板中没有定义任何内容。您的面板没有内容。

    你想放:

    <asp:Panel>
      Some Stuff
    </asp:Panel>
    

    【讨论】:

    • 是的。我这样做了。但它仍然没有显示 LinkBut​​ton1。
    • 刚刚更新了我的答案,您的面板中没有可显示的内容。
    • 实际上是废话,我的错。我正在格式化他的问题,看到一大块数字除了拉伸页面之外没有其他用途,所以我删除了它。然后我还删除了他在面板中的内容。
    猜你喜欢
    • 1970-01-01
    • 2012-06-08
    • 2014-09-09
    • 2011-05-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-18
    相关资源
    最近更新 更多