productlistcontrol_x3.ascx.vb

来自「C#语言制作asp.net网上商店的」· VB 代码 · 共 65 行

VB
65
字号
Imports NetShopForge.Library.Product
Imports NetShopForge.Library.Category


Partial Class Shop_Product_Controls_ProductListControl_X3
    Inherits System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            'gvSearchResult.DataSource = objPC.GetProductListByPage(1, 1)
            'gvSearchResult.DataBind()

            hfCategoryID.Value = My.Request("CatID")

            BindData()
            'CategoryMapPath.Text = "<a href=Default.aspx>首页</a>  :: " & ProductController.GetCategoryMapPath(hfCategoryID.Value)
        End If
    End Sub

    Private Sub BindData()
        Dim iCount As Integer


        Dim catID As String = hfCategoryID.Value
        If Not IsNothing(catID) And IsNumeric(catID) Then
            Dim ps As Product.ProductController.ProductSortType

            Select Case ddlSearch.SelectedValue
                Case "descPrice"
                    ps = ProductController.ProductSortType.descPrice
                Case "ascPrice"
                    ps = ProductController.ProductSortType.ascPrice

                Case "descSale"
                    ps = ProductController.ProductSortType.descSale
                Case "descTime"
                    ps = ProductController.ProductSortType.descTime
            End Select

            dlProduct.DataSource = ProductController.GetProductList(Pager.PageSize, Pager.CurrentPageIndex, iCount, CInt(catID), ps)
            dlProduct.DataBind()
            Pager.RecordCount = iCount
            Pager.CustomInfoHTML = "记录总数:" + Pager.RecordCount.ToString()
            Pager.CustomInfoHTML += " 总页数:" + Pager.PageCount.ToString()
            Pager.CustomInfoHTML += " 当前页:" + Pager.CurrentPageIndex.ToString()
        End If

    End Sub



    Protected Sub ChangePage(ByVal src As Object, ByVal e As EventArgs) Handles Pager.PageChanged
        ' Dim startTime As System.DateTime = System.DateTime.Now

        BindData()
        'Dim endTime As System.DateTime = System.DateTime.Now
        'Dim ts As System.TimeSpan = endTime - startTime
        ''   Label1.Text = "页面执行时间:" & ts.Milliseconds & " 毫秒"
    End Sub

    Protected Sub ddlSearch_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlSearch.SelectedIndexChanged
        BindData()
    End Sub
End Class

⌨️ 快捷键说明

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