【问题标题】:ColorBox (jquery plug in) my textbox values are empty after postbackColorBox(jquery插件)回发后我的文本框值为空
【发布时间】:2010-03-12 17:42:56
【问题描述】:

我在使用 ColorBox http://colorpowered.com/colorbox/ 时无法从文本框中获取值

我有一个打开 ColorBox 模式对话框的表单。在模式中,我有一个 asp.net 文本框和一个按钮,当我单击按钮时,我得到回发,但文本框的值始终为空。

<script type="text/javascript">
        $(document).ready(function () {
            $(".example8").colorbox({ width: "50%", inline: true, href: "#inline_example1" });
        });
    </script>

....

<form id="form1" runat="server">
    <a href="content/ohoopee1.jpg" rel="example8" title="abc">Click here</a></p> <a class='example8'
        href="#">Inline HTML</a></p>
    <!-- This contains the hidden content for inline calls -->
    <div style='display: none'>
        <div id='inline_example1' style='padding: 10px; background: #fff;'>
            <asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">LinkButton</asp:LinkButton><asp:TextBox
                ID="TextBox1" runat="server"></asp:TextBox>
        </div>
    </div>
    </form>

任何帮助将不胜感激。 谢谢。

【问题讨论】:

    标签: asp.net jquery colorbox


    【解决方案1】:

    尝试将以下代码添加到方法调用中:

    $("#colorbox").appendTo('form'); 
    

    所以您的代码将如下所示:

    <script type="text/javascript">
        $(document).ready(function () {
            $(".example8").colorbox({ width: "50%", inline: true, href: "#inline_example1" });
            $("#colorbox").appendTo('form');
        });
    </script>
    

    至少这对我有用!
    希望这会有所帮助!

    【讨论】:

    • 感谢您的回复!我似乎没有工作,但可能是因为我没有任何名为 colorbox 的元素。你的盒子里的彩盒是什么?如果你能把你的例子发给我,那将不胜感激。谢谢,皮尼。
    • 正如 Jack 在这篇文章 (stackoverflow.com/questions/6424638/…) 中所说的那样,您需要将附加应用到覆盖以及文章中。 $('#cboxOverlay, #colorbox').appendTo('form');。对我来说效果很好。
    【解决方案2】:

    出现此问题是因为 Colorbox 的内容是在表单标记之外创建的。 要解决此问题,请编辑 colorbox.cs 并编辑创建模式的方法。 如果您愿意,可以下载我更改的文件并解决问题。 http://www.coyote.inf.br/jquery.colorbox.js

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-24
      • 2017-10-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多