<asp:Menu ID="Menu1" runat="server" onmenuitemclick="Menu1_MenuItemClick" Orientation="Horizontal" Width="700px" ForeColor="Green" Font-Bold="true"> <Items> <asp:MenuItem Text="形态特征" Value="0" /> <asp:MenuItem Text="药材鉴别" Value="1" /> <asp:MenuItem Text="成份药理" Value="2" /> <asp:MenuItem Text="功效主治" Value="3" /> <asp:MenuItem Text="验方/妙用" Value="4" /> <asp:MenuItem Text="用药禁忌" Value="5" /> </Items> <LevelMenuItemStyles> <asp:MenuItemStyle BorderColor="Gray" BorderWidth="1px" Height="30px" HorizontalPadding="30px" /> </LevelMenuItemStyles> <LevelSelectedStyles> <asp:MenuItemStyle BackColor="SlateGray" ForeColor="White" /> </LevelSelectedStyles> </asp:Menu> <br /><br /> <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0"> <asp:View ID="View1" runat="server"> <div style="width:740px; margin:10px 10px; text-align:left; line-height:22px"> 药材鉴别 </div> </asp:View> <asp:View ID="View2" runat="server"> <div style="width:740px; margin:10px 10px; text-align:left; line-height:22px"> 药材鉴别 </div> </asp:View> <asp:View ID="View3" runat="server"> <div style="width:740px; margin:10px 10px; text-align:left; line-height:22px"> 药材鉴别 </div> </asp:View> <asp:View ID="View4" runat="server"> <div style="width:740px; margin:10px 10px; text-align:left; line-height:22px"> 药材鉴别 </div> </asp:View> <asp:View ID="View5" runat="server"> <div style="width:740px; margin:10px 10px; text-align:left; line-height:22px"> 药材鉴别 </div> </asp:View> <asp:View ID="View6" runat="server"> <div style="width:740px; margin:10px 10px; text-align:left; line-height:22px"> 药材鉴别 </div> </asp:View> </asp:MultiView>
添加Menu的Click事件:
protected void Menu1_MenuItemClick(object sender, MenuEventArgs e) { MultiView1.ActiveViewIndex = Int32.Parse(e.Item.Value); }效果:
- 本文标题: MultiView的用法
- 文章分类:【.NET/Web】
- 非特殊说明,本文版权归【胡同里的砖头】个人博客 所有,转载请注明出处.
- 上一篇:js设置自定义时间datetime
- 下一篇: C#如何从Excel里面导入数据