userrolecontrol.ascx.vb

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

VB
25
字号

Imports AspNetSecurity = System.Web.Security

Partial Class Admin_Management_Controls_UserRoleControl
    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
            hfUserName.Value = Request("username")
            ChangeView(hfUserName.Value)
        End If
    End Sub

    Private Sub ChangeView(ByVal UserName As String)
        Dim b As Boolean = AspNetSecurity.Roles.IsUserInRole(UserName, "Administrator")
        If b Then
            mvUserRole.ActiveViewIndex = 1
        Else
            mvUserRole.ActiveViewIndex = 0
        End If
    End Sub


End Class

⌨️ 快捷键说明

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