问题
I have a asp:menu that stops functioning after I perform a search on my page. The search uses a update panel and is triggered by a submit button. Once the results are displayed on the page the menu hover effects stop working. It will no longer expand down on mouseover. The clickable links still work.
The menu is in the site's master page and is outside the update panel of the search control.
Thank you for any help!
This is the menu
<asp:Menu ID="Menu5" runat="server"
DynamicEnableDefaultPopOutImage="False"
Orientation="Horizontal"
RenderingMode="List"
StaticEnableDefaultPopOutImage="False"
StaticPopOutImageUrl="~/Images/DownArrow.png"
Visible="False" Font-Bold="False" ForeColor="Black">
<Items>
<asp:MenuItem PopOutImageUrl="~/Images/bullet.png" Selectable="False" Text="Add" >
<asp:MenuItem Text="Item" NavigateUrl="~/Admin/CreateItem.aspx" ></asp:MenuItem>
<asp:MenuItem Text="Contact" NavigateUrl="~/Admin/CreateContact.aspx" ></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem Text="Update" Selectable="False" Value="Update">
<asp:MenuItem Text="Item" NavigateUrl="~/Admin/UpdateItem.aspx" Value="Item"></asp:MenuItem>
<asp:MenuItem Text="Contact" NavigateUrl="~/Admin/UpdateContact.aspx" Value="Contact"></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem Text="Approve" Selectable="False" Value="Approve" >
<asp:MenuItem Text="Item" NavigateUrl="~/Admin/ApproveItem.aspx" Value="Item"></asp:MenuItem>
<asp:MenuItem Text="Contact" NavigateUrl="~/Admin/ApproveContact.aspx" Value="Contact"></asp:MenuItem>
</asp:MenuItem>
</Items>
<StaticMenuItemStyle HorizontalPadding="10px" />
</asp:Menu>
This is the Button Click event
protected void btnSubmit_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
string keyword = txtSearch.Text.Trim();
List<dynamic> results = SearchItems(keyword);
List<dynamic> Cresults = SearchContacts(keyword);
//bind and return
lv.DataSource = results;
lv.DataBind();
//Contact Bind return
LVC.DataSource = Cresults;
LVC.DataBind();
}
}
回答1:
My solution is not to use the drag and drop menus from VS 2012. I replaced this with a Jquery Menu that wrote and have had no issues since.
来源:https://stackoverflow.com/questions/13686871/asp-menu-not-working-after-partial-postback