locked
HoverMenuExtender on page using ModalPopupExtender PostBackIssue RRS feed

  • Question

  • User279830882 posted

    I have a page that has a simple hovermenu extending a panel with a radiobuttonlist on it (just used to toggle a setting).  The problem is that the page also implements a modalpopup that displays the results of a search.  If I click on an item in the popup, everything works fine (popup closes, code runs, page posts back).  The problem is, after the postback caused by the popup, the hovermenu panel becomes stuck visible.

    Code is below:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="DirectorySpyWebEdition._default" %>
    
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
        <title>DirectorySpy: Web Edition</title>
        <link href="Style.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <form id="form1" runat="server">
            <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>
            <div id="header">
                <h2>DirectorySpy
                </h2>
            </div>
            <div id="search">
                <asp:Label ID="lblSearch" runat="server" Text="Search:" CssClass="lblSearch"></asp:Label>
                <asp:TextBox ID="txtSearch" runat="server" CssClass="txtSearch" BorderStyle="Solid" Font-Bold="True" Font-Size="X-Large"></asp:TextBox>
                <asp:ImageButton ID="imgBtnSearch" runat="server" ImageUrl="~/Images/Search-icon3.png" CssClass="imgBtn" OnClick="imgBtnSearch_Click" />
            </div>
            <div id="domainSelector">
                <asp:Button ID="btnDomain" runat="server" CssClass="btnDomain" Text="Domain &#9650;" />
                <asp:UpdatePanel ID="updPanelDomain" runat="server" UpdateMode="Always">
                    <ContentTemplate>
                        <asp:Panel ID="pnlDomain" runat="server">
                            <asp:RadioButtonList ID="rbListDomain" runat="server" CssClass="rbListDomain" >
                                <asp:ListItem Selected="True">Domain1.COM</asp:ListItem>
                                <asp:ListItem>Domain2.COM</asp:ListItem>
                            </asp:RadioButtonList>
                        </asp:Panel>
                    </ContentTemplate>
                </asp:UpdatePanel>
                <br />
                <asp:HoverMenuExtender ID="HoverMenuExtender1" runat="server" PopDelay="30" PopupControlID="pnlDomain" PopupPosition="Bottom" TargetControlID="btnDomain"></asp:HoverMenuExtender>
            </div>
            <div id="content">
                <table align="center">
                    <tr>
                        <td>
                            <asp:UpdatePanel ID="updPanelGeneralTab" runat="server" UpdateMode="Always" Visible="true">
                                <ContentTemplate>
                                    <asp:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" Width="100%">
                                        <asp:TabPanel ID="tabGeneral" runat="server" HeaderText="General">
                                            <ContentTemplate>
                                                <table class="tabTable">
                                                    <tr>
                                                        <td>
                                                            <asp:GridView ID="gvGeneralTab" runat="server" CssClass="grid" AutoGenerateColumns="False" ShowHeader="False">
                                                                <Columns>
                                                                    <asp:BoundField DataField="attribute">
                                                                        <ItemStyle Width="150px" Font-Bold="True" />
                                                                    </asp:BoundField>
                                                                    <asp:TemplateField HeaderText="value">
                                                                        <ItemTemplate>
                                                                            <asp:Label ID="Label22" runat="server" Text='<%# Bind("value") %>'></asp:Label>
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>
                                                                </Columns>
                                                            </asp:GridView>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </ContentTemplate>
                                        </asp:TabPanel>
                                        <asp:TabPanel ID="tabAddress" runat="server" HeaderText="Address">
                                            <ContentTemplate>
                                                <table class="tabTable">
                                                    <tr>
                                                        <td>
                                                            <asp:GridView ID="gvAddressTab" runat="server" CssClass="grid" AutoGenerateColumns="False" ShowHeader="False">
                                                                <Columns>
                                                                    <asp:BoundField DataField="attribute">
                                                                        <ItemStyle Width="150px" Font-Bold="true" />
                                                                    </asp:BoundField>
                                                                    <asp:TemplateField HeaderText="value">
                                                                        <ItemTemplate>
                                                                            <asp:Label ID="Label23" runat="server" Text='<%# Bind("value") %>'></asp:Label>
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>
                                                                </Columns>
                                                            </asp:GridView>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </ContentTemplate>
                                        </asp:TabPanel>
                                        <asp:TabPanel ID="tabObjectInfo" runat="server" HeaderText="Object Info">
                                            <ContentTemplate>
                                                <table class="tabTable">
                                                    <tr>
                                                        <td>
                                                            <asp:GridView ID="gvObjectInfoTab" runat="server" CssClass="grid" AutoGenerateColumns="False" ShowHeader="False">
                                                                <Columns>
                                                                    <asp:BoundField DataField="attribute">
                                                                        <ItemStyle Width="150px" Font-Bold="true" />
                                                                    </asp:BoundField>
                                                                    <asp:TemplateField HeaderText="value">
                                                                        <ItemTemplate>
                                                                            <asp:Label ID="Label24" runat="server" Text='<%# Bind("value") %>'></asp:Label>
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>
                                                                </Columns>
                                                            </asp:GridView>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </ContentTemplate>
                                        </asp:TabPanel>
                                        <asp:TabPanel ID="tabExchange" runat="server" HeaderText="Exchange">
                                            <ContentTemplate>
                                                <table class="tabTable">
                                                    <tr>
                                                        <td>
                                                            <asp:GridView ID="gvExchangeTab" runat="server" CssClass="grid" AutoGenerateColumns="False" ShowHeader="False">
                                                                <Columns>
                                                                    <asp:BoundField DataField="attribute">
                                                                        <ItemStyle Width="150px" Font-Bold="true" />
                                                                    </asp:BoundField>
                                                                    <asp:TemplateField HeaderText="value">
                                                                        <ItemTemplate>
                                                                            <asp:Label ID="Label24" runat="server" Text='<%# Bind("value") %>'></asp:Label>
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>
                                                                </Columns>
                                                            </asp:GridView>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </ContentTemplate>
                                        </asp:TabPanel>
                                        <asp:TabPanel ID="tabProxyAddresses" runat="server" HeaderText="Proxy Addresses">
                                            <ContentTemplate>
                                                <table class="tabTable">
                                                    <tr>
                                                        <td>
                                                            <asp:GridView ID="gvProxyAddressesTab" runat="server" AutoGenerateColumns="False" CssClass="grid" ShowHeader="False">
                                                                <Columns>
                                                                    <asp:BoundField DataField="proxyAddress" />
                                                                </Columns>
                                                            </asp:GridView>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </ContentTemplate>
                                        </asp:TabPanel>
                                        <asp:TabPanel ID="tabRestrictions" runat="server" HeaderText="Restrictions">
                                            <ContentTemplate>
                                                <table class="tabTable">
                                                    <tr>
                                                        <td>
                                                            <asp:GridView ID="gvRestrictionsTab" runat="server" AutoGenerateColumns="False" CssClass="grid" ShowHeader="False">
                                                                <Columns>
                                                                    <asp:BoundField DataField="authOrig" />
                                                                </Columns>
                                                            </asp:GridView>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </ContentTemplate>
                                        </asp:TabPanel>
                                        <asp:TabPanel ID="tabMembers" runat="server" HeaderText="Members">
                                            <ContentTemplate>
                                                <table class="tabTable">
                                                    <tr>
                                                        <td>
                                                            <asp:GridView ID="gvMembersTab" runat="server" AutoGenerateColumns="False" CssClass="grid" ShowHeader="False">
                                                                <Columns>
                                                                    <asp:BoundField DataField="member" />
                                                                </Columns>
                                                            </asp:GridView>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </ContentTemplate>
                                        </asp:TabPanel>
                                        <asp:TabPanel ID="tabMemberOf" runat="server" HeaderText="Member Of">
                                            <ContentTemplate>
                                                <table class="tabTable">
                                                    <tr>
                                                        <td>
                                                            <asp:GridView ID="gvMemberOfTab" runat="server" AutoGenerateColumns="False" CssClass="grid" ShowHeader="False">
                                                                <Columns>
                                                                    <asp:BoundField DataField="memberOf" />
                                                                </Columns>
                                                            </asp:GridView>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </ContentTemplate>
                                        </asp:TabPanel>
                                        <asp:TabPanel ID="tabManagerOf" runat="server" HeaderText="Manager Of">
                                            <ContentTemplate>
                                                <table class="tabTable">
                                                    <tr>
                                                        <td>
                                                            <asp:GridView ID="gvManagerOfTab" runat="server" AutoGenerateColumns="False" CssClass="grid" ShowHeader="False">
                                                                <Columns>
                                                                    <asp:BoundField DataField="managedObjects" />
                                                                </Columns>
                                                            </asp:GridView>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </ContentTemplate>
                                        </asp:TabPanel>
                                        <asp:TabPanel ID="tabPhoto" runat="server" HeaderText="Photo">
                                            <ContentTemplate>
                                                <table class="tabTable">
                                                    <tr>
                                                        <td align="center">
                                                            <asp:Image ID="thumbnailPhoto" runat="server" ImageUrl="~/Images/sil_med.png" />
                                                        </td>
                                                    </tr>
                                                </table>
                                            </ContentTemplate>
                                        </asp:TabPanel>
                                    </asp:TabContainer>
                                </ContentTemplate>
                            </asp:UpdatePanel>
                        </td>
                    </tr>
                </table>
            </div>
            <div id="footer">
            </div>
            <!-- Search Popup -->
            <asp:Button ID="popupSearchTargetControl" runat="server" Style="display: none" />
            <asp:ModalPopupExtender ID="popupSearch" runat="server" BackgroundCssClass="modalBackground" TargetControlID="popupSearchTargetControl" PopupControlID="pnlPopupSearch" BehaviorID="bPopupSearch"></asp:ModalPopupExtender>
            <asp:Panel ID="pnlPopupSearch" runat="server" CssClass="popupSearch">
                <asp:UpdatePanel ID="updPanelPopupSearch" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <table id="tblPopupSearchHeader" align="center" cellpadding="0" cellspacing="0" width="100%">
                            <tr>
                                <td style="border-bottom: solid; border-width: 3px; background-color: #c8332e; color: white; font-family: 'Cordia New'; border-bottom-color: black;" align="left">
                                    <div style="padding-left: 10px; font: bold; font-size: large;">
                                        Search Results:<asp:Label ID="lblPopupSearchHeader" runat="server"></asp:Label>
                                    </div>
                                </td>
                                <td align="right" style="background-color: #c8332e; color: white; border-bottom: solid; border-bottom-color: black; border-width: 3px; vertical-align: bottom;">
                                    <asp:Button ID="Button2" runat="server" BackColor="Black" BorderStyle="None" ForeColor="White" Height="25px" OnClientClick="$find('bPopupSearch').hide(); return false;" Text="X" Width="25px" />
                                </td>
                            </tr>
                        </table>
                        <table width="100%">
                            <tr>
                                <td>
                                    <asp:GridView ID="gvSearchResults" runat="server" AutoGenerateColumns="False" Font-Names="Cordia New" AllowPaging="True" Width="100%" OnPageIndexChanging="gvSearchResults_PageIndexChanging" CssClass="searchResultsGrid" OnRowCommand="gvSearchResults_RowCommand">
    
                                        <Columns>
                                            <asp:TemplateField HeaderText="cn">
                                                <ItemTemplate>
                                                    <asp:LinkButton ID="LinkButton1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "cn") %>' CommandArgument='<%# DataBinder.Eval(Container.DataItem, "adsPath") %>' CommandName="loadObject"></asp:LinkButton>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="objectClass">
                                                <ItemTemplate>
                                                    <asp:Label ID="Label18" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "objectClass") %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="sAMAccountName">
                                                <ItemTemplate>
                                                    <asp:Label ID="Label19" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "sAMAccountName") %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="physicalDeliveryOfficeName">
                                                <ItemTemplate>
                                                    <asp:Label ID="Label20" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "physicalDeliveryOfficeName") %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="adsPath" Visible="False">
                                                <ItemTemplate>
                                                    <asp:Label ID="Label21" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "adsPath") %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                        </Columns>
                                        <PagerSettings Mode="NumericFirstLast" />
                                    </asp:GridView>
                                </td>
                            </tr>
                        </table>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </asp:Panel>
            <!-- Empty Search Results Panel-->
            <asp:Button ID="popupNoSearchResultsTargetControl" runat="server" Style="display: none" />
            <asp:ModalPopupExtender ID="popupNoSearchResults" runat="server" BackgroundCssClass="modalBackground" TargetControlID="popupNoSearchResultsTargetControl" PopupControlID="pnlPopupNoSearchResults" BehaviorID="bPopupNoSearchResults"></asp:ModalPopupExtender>
            <asp:Panel ID="pnlPopupNoSearchResults" runat="server" CssClass="popupNoSearchResults">
                <asp:UpdatePanel ID="updPanelPopupNoSearchResults" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <table id="tblPopupNoSearchResultsHeader" align="center" cellpadding="0" cellspacing="0" width="100%">
                            <tr>
                                <td style="border-bottom: solid; border-width: 3px; background-color: #c8332e; color: white; font-family: 'Cordia New'; border-bottom-color: black;" align="left">
                                    <div style="padding-left: 10px; font: bold; font-size: large;">
                                        Search Results:<asp:Label ID="lblPopupNoSearchResultsHeader" runat="server"></asp:Label>
                                    </div>
                                </td>
                                <td align="right" style="background-color: #c8332e; color: white; border-bottom: solid; border-bottom-color: black; border-width: 3px; vertical-align: bottom;">
                                    <asp:Button ID="Button1" runat="server" BackColor="Black" BorderStyle="None" ForeColor="White" Height="25px" OnClientClick="$find('bPopupNoSearchResults').hide(); return false;" Text="X" Width="25px" />
                                </td>
                            </tr>
                        </table>
                        <table width="100%">
                            <tr>
                                <td>
    
                                </td>
                            </tr>
                            <tr>
                                <td align="center" style="font-family:'Cordia New';">
                                    <asp:Label ID="Label1" runat="server" Text="No objects found..." Font-Size="X-Large"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td>
    
                                </td>
                            </tr>
                            <tr>
                                <td align="center">
                                    <asp:Button ID="btnCloseNoResultsPopup" runat="server" CssClass="btn" Text="Close" OnClick="btnCloseNoResultsPopup_Click" />
                                </td>
                            </tr>
                        </table>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </asp:Panel>
    
        </form>
    </body>
    </html>
    

    Thursday, September 25, 2014 11:55 AM

Answers

  • User279830882 posted

    Well... I had an idea... after a day of scratching my head (should have noticed earlier).  I resolved the issue by wrapping the page in an updatepanel (everything between the form tags).

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, September 25, 2014 12:11 PM

All replies

  • User279830882 posted

    Well... I had an idea... after a day of scratching my head (should have noticed earlier).  I resolved the issue by wrapping the page in an updatepanel (everything between the form tags).

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, September 25, 2014 12:11 PM
  • User-1926401737 posted

    Well... I had an idea... after a day of scratching my head (should have noticed earlier).  I resolved the issue by wrapping the page in an updatepanel (everything between the form tags).

    Good job.

    Tuesday, October 7, 2014 4:13 AM