-1

modalpopupextenderが現在javascriptを使用して表示されているかどうかを検出するにはどうすればよいですか?

Modalpopupextenderマークアップ

  <!-- Add Files Modal Form -->
    <asp:HiddenField ID="AddFilesForModal" runat="server" />
    <ajaxToolkit:ModalPopupExtender runat="server" ID="AddFilesModal" BehaviorID="modalPopupExtenderAddFiles"
        TargetControlID="dummyButtonAddToPendingList" PopupDragHandleControlID="PanelAddFilesOuter" PopupControlID="PanelAddFilesOuter"
        OkControlID="dummyButtonAddToPendingList" BackgroundCssClass="modalBackground" DropShadow="false"
        Drag="true">
    </ajaxToolkit:ModalPopupExtender>
    <ajaxToolkit:RoundedCornersExtender ID="RoundedCornersExtender4" runat="server" TargetControlID="PanelAddFilesInner">
    </ajaxToolkit:RoundedCornersExtender>
    <asp:Panel ID="PanelAddFilesOuter" runat="server"   BackColor="Transparent" Style="display: none;">
        <asp:Panel ID="PanelAddFilesInner" runat="server" BackColor="White" Style=" width:800px; height:600px;  overflow:auto;">
         <ContentTemplate>
            <div id="AddFilesContainer" style="  padding-left:10px; padding-right:10px; padding-top:10px; padding-bottom:5px;">
                <br />
                Add Files
                <div  id="AddFiles_Div" style="height:80%;overflow:auto;">
                            <asp:TreeView ID="TreeViewAddItems" runat="server" Height="500px"  ShowCheckBoxes="Leaf"
                                Width="380px" ImageSet="XPFileExplorer" NodeIndent="15" PathSeparator="\" ShowExpandCollapse="true"
                                EnableClientScript="true" OnTreeNodeCheckChanged="OnTreeNodeCheckChanged" OnAdaptedTreeNodeCheckChanged="OnTreeNodeCheckChanged" ShowLines="True">
                                <HoverNodeStyle Font-Underline="True" ForeColor="#6666AA" />
                                <NodeStyle Font-Names="Tahoma" Font-Size="10pt" ForeColor="Black" HorizontalPadding="2px"
                                    NodeSpacing="0px" VerticalPadding="2px" />
                                <ParentNodeStyle Font-Bold="False" />
                                <SelectedNodeStyle BackColor="#B5B5B5" Font-Underline="False" HorizontalPadding="0px"
                                    VerticalPadding="0px" />
                            </asp:TreeView>
                            </div>
                <br />
                <div class="base" style="height:20px;">
                <asp:LinkButton ID="lnkAddToPendingList" runat="server" OnClick="BtnAddToPendingList_Click" BorderStyle="Solid" BackColor="#CCCCCC">Add selected items to list</asp:LinkButton>
                <asp:Button CssClass="Button" ID="dummyButtonAddToPendingList" runat="server" Style="display: none;" />
                <asp:Button CssClass="Button" ID="CancelAddFiles" runat="server" Text="Cancel" OnClientClick="$find('modalPopupExtenderAddFiles').hide(); return false;" />
                </div>
                </div>
                </ContentTemplate>
        </asp:Panel>
    </asp:Panel>
    <!-- End Add Files Modal Form -->
4

2 に答える 2

2

呼べる物件はないと思います。おそらく、表示されているイベントと非表示になっているイベントに接続する必要があります。このようなもの:

var amIVisible = false;
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(function () {
    $find('modalPopupExtenderAddFiles').add_shown(function () {
        amIVisible = true;
    });

    $find('modalPopupExtenderAddFiles').add_hidden(function () {
        amIVisible = false;
    });
});
于 2013-01-25T18:53:45.627 に答える
1

BehaviourIDを使用して、クライアント側で確認します。

<script type="text/javascript">

function IsVisible()
{
    var modalPopup = $find('ModalBehaviourID');
    return modalPopup ? true : false;
}
</script>

2番目のオプション:

<script type="text/javascript" >

function IsVisible()
{
    return $find('ModalBehaviourID').get_PopupVisible();
}

</script>

出典:リンク

于 2013-01-25T18:47:15.820 に答える