2013-09-27 60 views
0

我在使用带有ASP.NET WebForm的Colorbox时遇到了问题。我所试图做的是:Colorbox + ASP.NET WebForm提交按钮

  1. 用户点击一个链接,和颜色框弹出
  2. 内部颜色框,用户在文本框中输入一个术语,点击提交按钮
  3. 在提交时,网页点击率数据库,然后显示结果(仍在彩盒内)

现在,我有步骤#1 &#2工作,但#3不是。如果我点击提交按钮,浏览器将导航到在colorbox(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> 

谁能帮我找出我在做什么错?

回答

0

你必须加载一个iframe中的颜色框内容:

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