简体   繁体   English

控件在jQuery模式对话框中不起作用

[英]Controls not functioning in jquery modal dialog

I'm using the jquery dialog in my ASP.net web app. 我在ASP.net Web应用程序中使用了jquery对话框。 Within it I have a user control with some link. 在其中,我有一个带有某些链接的用户控件。 When the dialog is in modal mode, the links are not selectable. 当对话框处于模式模式时,链接是不可选择的。

I tried the workaround in this post, but it did not work for me. 我在这篇文章中尝试了解决方法,但对我而言不起作用。

Update 更新资料
Added a post to ComponentArt forum here . 将讯息加入了ComponentArt论坛在这里 It seems to be related to the component art TabStrip control. 它似乎与组件艺术TabStrip控件有关。 A link in here isn't working correctly, but works outside of the tabstrip. 此处的链接无法正常工作,但可以在Tabstrip外部使用。 See markup added below: 请参阅下面添加的标记:

        var dlg = $("#dialog-form").dialog({
            autoOpen: false,
            height: 650,
            width: 700,
            modal: true,
            buttons: {

                close: function () {
                    $(this).dialog("close");
                }
            }
        });

        dlg.parent().appendTo($('form:first'));

<div id="dialog-form" title="">
<ComponentArt:tabstrip runat="server"
                          CssClass="TopGroup"
                          SiteMapXmlFile="../UserControls/AppDetailsTabData.xml"
                          DefaultItemLookId="DefaultTabLook"
                          DefaultSelectedItemLookId="SelectedTabLook"
                          DefaultDisabledItemLookId="DisabledTabLook"
                          DefaultGroupTabSpacing="1"
                          ImagesBaseUrl="../App_Themes/Default/Tab/images/"
                          MultiPageId="MultiPage1"
                          runat="server">
    <ItemLooks>
        <ComponentArt:ItemLook LookId="DefaultTabLook" CssClass="DefaultTab" HoverCssClass="DefaultTabHover" LabelPaddingLeft="10" LabelPaddingRight="10" LabelPaddingTop="5" LabelPaddingBottom="4" LeftIconUrl="tab_left_icon.gif" RightIconUrl="tab_right_icon.gif" HoverLeftIconUrl="hover_tab_left_icon.gif" HoverRightIconUrl="hover_tab_right_icon.gif" LeftIconWidth="3" LeftIconHeight="21" RightIconWidth="3" RightIconHeight="21" />
        <ComponentArt:ItemLook LookId="SelectedTabLook" CssClass="SelectedTab" LabelPaddingLeft="10" LabelPaddingRight="10" LabelPaddingTop="4" LabelPaddingBottom="4" LeftIconUrl="selected_tab_left_icon.gif" RightIconUrl="selected_tab_right_icon.gif" LeftIconWidth="3" LeftIconHeight="21" RightIconWidth="3" RightIconHeight="21" />
    </ItemLooks>

</ComponentArt:tabstrip>

<ComponentArt:MultiPage id="MultiPage1" CssClass="MultiPage" runat="server">
    <ComponentArt:PageView CssClass="PageContent" runat="server">

        <a href="www.google.com">click me</a>

    </ComponentArt:PageView>

    <ComponentArt:PageView CssClass="PageContent" runat="server">

    </ComponentArt:PageView>

</ComponentArt:MultiPage>

摆脱了组件艺术的控制,使自己的控制变得简单得多,并且可以与他人很好地玩耍。

First of all your control's wrapper div <div id="dialog-form" title=""> has no closing tag </div> but it could be a typo here, whatever check this again to make sure that the closing tag </div> is not missing. 首先,控件的包装div <div id="dialog-form" title="">没有结束标记</div>但是这里可能是错字,无论如何再次检查以确保结束标记</div>不丢失。

But in this dlg.parent().appendTo($('form:first')); 但是在这个dlg.parent().appendTo($('form:first')); line you are trying to append the parent container of <div id="dialog-form" title=""> which is dlg not the dlg itself and I didn't see any parent wrapper of <div id="dialog-form" title=""> in your code, so it could be a problem. 您要添加<div id="dialog-form" title=""> which is dlgparent container<div id="dialog-form" title=""> which is dlg不是dlg本身<div id="dialog-form" title=""> which is dlg ,而且我没有看到<div id="dialog-form" title="">任何父包装器您代码中的<div id="dialog-form" title=""> ,所以可能是一个问题。 In your code the following line means 在您的代码中,以下行表示

`dlg.parent().appendTo($('form:first'));`

Append the dlg's parent or append the parent div of this( <div id="dialog-form" title=""> )div in to the first form of the page. 追加dlg的父级或将此( <div id="dialog-form" title=""> )div的父级div追加到页面的第一个表单中。

If you want to append the dlg which refers to <div id="dialog-form" title=""> in to the first form then you should write 如果要在第一个表单中附加引用<div id="dialog-form" title="">dlg ,则应编写

dlg.appendTo($('form:first'));

or 要么

$('form:first').append(dlg);

or 要么

$($('form')[0]).append(dlg);

I guess this should be your answer. 我想这应该是您的答案。 See the modal option description. 请参阅模式选项说明。 It disables other elements and creates layer over hyperlinks or other form elements. 它禁用其他元素,并在超链接或其他表单元素上创建图层。 This layer prevents links from working. 该层阻止链接工作。

http://jqueryui.com/demos/dialog/#modal-message http://jqueryui.com/demos/dialog/#modal-message

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM