editnewscategorycontrol.ascx.vb

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

VB
56
字号

Imports NetShopForge.Library.News

Partial Class Admin_Management_Controls_EditNewsCategoryControl
    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
            Dim newsCategoryID As Integer = Request("newsCategoryID")
            Dim action As String = Request("action")
            hfAction.Value = action
            hfNewsCatID.Value = newsCategoryID
            If Not action.ToLower = "addnew" Then
                BindData(newsCategoryID)
            End If

        End If
    End Sub


#Region "---Private Method---"

    Private Sub BindData(ByVal newsCategoryID As Integer)

        Dim objNC As New NewsController
        Dim objNewsCategory As NewsCategoryInfo
        objNewsCategory = objNC.GetNewsCategory(newsCategoryID)

        txtDescription.Text = objNewsCategory.Description
        txtName.Text = objNewsCategory.Name
        ddlIsVaild.SelectedValue = CInt(objNewsCategory.IsValid)
        ddlIsSubscription.SelectedValue = CInt(objNewsCategory.IsSubscription)
        ddlIsSiteNews.SelectedValue = CInt(objNewsCategory.IsSiteNews)
    End Sub

#End Region
#Region "---Event Method----"

    Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click
        Dim newsCC As New NewsController
        Dim ncInfo As New NewsCategoryInfo

        ncInfo.NewsCategoryID = hfNewsCatID.Value
        ncInfo.Description = txtDescription.Text
        ncInfo.IsSiteNews = CBool(ddlIsSiteNews.SelectedValue)
        ncInfo.IsSubscription = CBool(ddlIsSubscription.SelectedValue)
        ncInfo.IsValid = CBool(ddlIsVaild.SelectedValue)
        ncInfo.Name = txtName.Text
        newsCC.UpdateNewsCategory(ncInfo)

    End Sub

#End Region

End Class

⌨️ 快捷键说明

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