Results 1 to 7 of 7

Thread: asp:menu and AJAX Updatepanel

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Denmark
    Posts
    1,049

    asp:menu and AJAX Updatepanel

    This is REALLY strange! I have an asp:menu. Leaving it outside updatepanel the functionality is fine

    I put this into an updatepanel. Then the functionality for dynamichover works ok until the first postback. After that the dynamichover is not set, but when you click the menu it is working fine, the active link is working.

    Can someone please help me in this? It is the attribute with the "purple" that fails.
    Thanks in advance.
    I have tried several hacks and bug fixes without any luck, so please post code.

    Code:
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="UpdatePanel.aspx.vb" Inherits="UpdatePanel" %>
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
    
    
    <!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">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        <tr>
                <td>
                    <asp:ScriptManager ID="ScriptManager1" runat="server" />
                    <asp:UpdatePanel runat="server" id="UpdatePanel" updatemode="Conditional">
                    <Triggers>
                        <asp:AsyncPostBackTrigger controlid="UpdateButton2" eventname="Click" />
                    </Triggers>
                        <ContentTemplate>
                            <asp:Label runat="server" id="DateTimeLabel1" />
                            <asp:Button runat="server" id="UpdateButton1" onclick="UpdateButton_Click" text="UpdateØverst" />               
                        </ContentTemplate>
                    </asp:UpdatePanel>
                    <asp:UpdatePanel runat="server" id="UpdatePanel1" updatemode="Conditional">           
                        <ContentTemplate>
                            <asp:Label runat="server" id="DateTimeLabel2" />
                            <asp:Button runat="server" id="UpdateButton2" onclick="UpdateButton_Click" text="UpdateNederst" />
                                   <asp:Menu ID="Menu1" runat="server" BackColor="White" Font-Bold="True"
                                    Font-Names="Arial" Font-Size="8pt" ForeColor="White" Orientation="Horizontal"
                                    StaticSubMenuIndent="" Style="border-right: gray 1px solid; border-top: gray 1px solid;
                                    font-size: 10pt; text-transform: none; border-left: gray 1px solid; cursor: hand;
                                    text-indent: 10pt; border-bottom: gray 1px solid; font-family: Arial; background-color: lavender">
                                    <StaticMenuItemStyle BackColor="#0082d1" HorizontalPadding="1px" VerticalPadding="2px" />
                                    <DynamicHoverStyle BackColor="purple" Font-Names="Arial" ForeColor="White" />
                                    <DynamicMenuStyle BackColor="#F7F6F3" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />
                                    <StaticSelectedStyle BackColor="#054798" ForeColor="White" />
                                    <DynamicSelectedStyle BackColor="#054798" ForeColor="white" Font-Size="8pt" />
                                    <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" ForeColor="#696969" />
                                    <StaticHoverStyle BackColor="Navy" ForeColor="White" />
                                    <Items>
                                        <asp:MenuItem Text="Test1" Value="1-1">
                                            <asp:MenuItem Text="Along pipe" Value="1-1"></asp:MenuItem>
                                            <asp:MenuItem Text="Over fittings" Value="1-2"></asp:MenuItem>
                                            <asp:MenuItem Text="Over valves" Value="1-3"></asp:MenuItem>
                                            <asp:MenuItem Text="Network calculation" Value="1-4"></asp:MenuItem>
                                            <asp:MenuItem Text="Comparison" Value="1-5"></asp:MenuItem>
                                        </asp:MenuItem>
                                        <asp:MenuItem Text="test2" Value="2-1">
                                            <asp:MenuItem Text="Condensation or not" Value="2-1"></asp:MenuItem>
                                            <asp:MenuItem Text="Minimum insulation thickness" Value="2-2"></asp:MenuItem>
                                            <asp:MenuItem Text="Humidity guideline values" Value="2-3"></asp:MenuItem>
                                            <asp:MenuItem Text="Comparison" Value="2-4"></asp:MenuItem>
                                        </asp:MenuItem>
                                                                
                                    </Items>
                                    
                                </asp:Menu>                         
    
    
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </td>
                <td>
                
    
                </td>
            </tr>   
        </div>
        </form>
    </body>
    </html>
    My only code for code behind is:
    Code:
    Partial Class UpdatePanel
        Inherits System.Web.UI.Page
        Protected Sub menu1_MenuItemClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) Handles Menu1.MenuItemClick
            DateTimeLabel1.Text = Menu1.SelectedItem.Value 'DateTime.Now.ToString()
            DateTimeLabel2.Text = Menu1.SelectedItem.Text 'DateTime.Now.ToString()
        End Sub
    End Class
    Last edited by hpl; Aug 29th, 2012 at 07:51 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width