menu.aspx

来自「visual studio.net学习资料」· ASPX 代码 · 共 41 行

ASPX
41
字号
<%@ Page Language="vb" %>
<%@ Import Namespace="System.Data" %>

<script language="VB" runat="server">        

    Sub Page_Load(sender As Object, e As EventArgs) 
            
        Dim dvMenuItems As DataView 
        Dim products As New Conference.ProductsDB 
            
        dvMenuItems = products.GetProductCategories().Tables(0).DefaultView
        
        ' Bind the DataView of menu items to the list
        lstMenu.DataSource = dvMenuItems
        lstMenu.DataBind()
        
    End Sub

</script>

<html>

  <body>

    <asp:DataList id="lstMenu" width="145" runat="server">
      <template name="ItemTemplate">
         
         <asp:HyperLink id="HyperLink1" CssClass="MenuUnselected"
			Text='<%# Container.DataItem("CategoryName") %>' 
			NavigateUrl='<%# "productslist.aspx?CategoryID=" & _
				Container.DataItem("CategoryID") %>' 
			runat="server" />
                                  
      </template>
                                                                  
    </asp:DataList>
     
  </body>

</html>      
                    

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?