我用Menu+MultiView来实现tabpage,在Menu的MenuItemClick事件来控制MultiView的ActiveViewIndex,但是运行时却发现点击MenuItem却没有任何反应,也没有出现postback。不知各位有没碰到过?

解决方案 »

  1.   

    HTML代码如下:<asp:ScriptManager ID="myScriptManager" runat="server">
            </asp:ScriptManager>
            <asp:Menu ID="Menu2" runat="server" BackColor="#E3EAEB" DynamicHorizontalOffset="2"
                Font-Names="Verdana" Font-Size="0.8em" ForeColor="#666666" OnMenuItemClick="Menu2_MenuItemClick"
                Orientation="Horizontal" StaticSubMenuIndent="10px" Style="z-index: 100; left: 454px;
                position: absolute; top: 16px">
                <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
                <DynamicHoverStyle BackColor="#666666" ForeColor="White" />
                <DynamicMenuStyle BackColor="#E3EAEB" />
                <StaticSelectedStyle BackColor="#1C5E55" ForeColor="White" />
                <DynamicSelectedStyle BackColor="#1C5E55" />
                <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
                <Items>
                    <asp:MenuItem Selected="True" Text="Page1" Value="0"></asp:MenuItem>
                    <asp:MenuItem Text="Page2" Value="1"></asp:MenuItem>
                    <asp:MenuItem Text="Page3" Value="2"></asp:MenuItem>
                </Items>
                <StaticHoverStyle BackColor="#666666" ForeColor="White" />
            </asp:Menu>        
            <asp:UpdatePanel ID="myUpdatePanel" runat="server">
                <ContentTemplate>
                    <asp:Panel ID="Panel1" runat="server" BorderStyle="Inset" Height="359px" Style="z-index: 101;
                        left: 454px; position: absolute; top: 35px" Width="435px">
                        <asp:MultiView ID="MultiView2" runat="server" ActiveViewIndex="0">
                            <asp:View ID="View4" runat="server">
                                <asp:Label ID="Label2" runat="server" Style="z-index: 100; left: 1px; position: absolute;
                                    top: 27px" Text="myLabel2 test test" Width="253px"></asp:Label>
                            </asp:View>
                            <asp:View ID="View5" runat="server">
                                <asp:TextBox ID="TextBox2" runat="server" Style="z-index: 100; left: 10px; position: absolute;
                                    top: 49px" Width="253px"></asp:TextBox>
                            </asp:View>
                            <asp:View ID="View6" runat="server">
                                <asp:ListBox ID="ListBox1" runat="server" Height="230px" Style="z-index: 100; left: 84px;
                                    position: absolute; top: 45px" Width="196px">
                                    <asp:ListItem>item1</asp:ListItem>
                                    <asp:ListItem>item2</asp:ListItem>
                                    <asp:ListItem>item3</asp:ListItem>
                                    <asp:ListItem>item4</asp:ListItem>
                                </asp:ListBox>
                            </asp:View>
                        </asp:MultiView></asp:Panel>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="Menu2" EventName="MenuItemClick" />
                </Triggers>
            </asp:UpdatePanel>
      

  2.   

    我没用ajax的UpdatePanel前试过点击Menu的Item时是没有postback动作的,用断点跟踪也发现没有执行到MenuItemClick事件。后来发现Ajax程序都起不了作用,开始以为是Ajax的缘故,于是重装了Ajax,结果还是不行。郁闷……