asp.net - ColorBox(jquery 插件)回发后我的文本框值为空

标签 asp.net jquery colorbox

使用 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>

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

最佳答案

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

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

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

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

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

关于asp.net - ColorBox(jquery 插件)回发后我的文本框值为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2434659/

相关文章:

asp.net - Web 开发设置

php - 当我从 PHP 传递字符串时,ajax 代码停止运行

javascript - 拉伸(stretch)背景渐变高度为 : 100% on html

javascript - 使用 Colorbox jquery 插件时,根据视口(viewport)自动调整 innerWidth 和 innerHeight 的大小

jquery colorbox 图像边框

C# 如何为 selectedValue = null 设置 dropDownList 默认值

asp.net - Resx 文件在可移植类库中无法正常工作

jquery - 最佳实践 - 从 Web 服务抛出异常

jquery - 在 IE 中使用 jQuery 删除 iframe 后 Youtube 音频仍在播放

javascript - 如何使用 javascript 关闭 colorbox iframe?