【问题标题】:Colorbox + ASP.NET WebForm Submit ButtonColorbox + ASP.NET WebForm 提交按钮
【发布时间】:2013-09-27 18:05:07
【问题描述】:

我在使用带有 ASP.NET WebForm 的 Colorbox 时遇到问题。我想做的是:

  1. 用户点击链接,弹出颜色框
  2. 在颜色框内,用户在文本框中输入术语并单击提交按钮
  3. 提交时,页面点击数据库,然后显示结果(仍在颜色框内)

现在,我的第 1 步和第 2 步正在运行,但第 3 步没有。如果我单击提交按钮,浏览器会导航到在颜色框 (FAQ.aspx) 中加载的页面。

Test.aspx

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Test Page</title>
<link href="css/colorbox.css" rel="stylesheet" />
<script src="js/jquery-1.10.2.min.js"></script>
<script src="js/jquery.colorbox.js"></script>
</head>
<body>
   <form id="form1" runat="server">
   <div>
     <a class="cbox">FAQs</a>
   </div>
   </form>
   <script>
      $(document).ready(function () {
        var colorbox = $("#colorbox");
        $('form#Form1').prepend(colorbox);
      });
      $('a.cbox').colorbox({ href: "FAQ.aspx" });
    </script>
</body>
</html>

FAQ.aspx

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
  <title>Frequently Asked Questions</title>
</head>
<body>
  <form id="form1" runat="server">
  <div>
    Search: <asp:TextBox runat="server" ID="txtSearch" /> <asp:Button runat="server" ID="btnSubmitSearch" Text="Submit" OnClick="btnSubmitSearch_Click"/>
    <br />
    <asp:scriptmanager ID="Scriptmanager1" runat="server"></asp:scriptmanager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:Literal ID="litOutput" runat="server" />
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnSubmitSearch" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>
    <br />
  </div>
  </form>
</body>
</html>

谁能帮我弄清楚我做错了什么?

【问题讨论】:

    标签: asp.net webforms colorbox


    【解决方案1】:

    您必须在 iframe 中加载彩盒内容:

    $('a.cbox').colorbox({ href: "FAQ.aspx", iframe: true, width: 456, height: 100 });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-14
      • 2016-06-06
      • 1970-01-01
      • 2018-07-11
      • 1970-01-01
      • 1970-01-01
      • 2016-03-14
      • 2011-09-30
      相关资源
      最近更新 更多