ShowHideGridViewColumnsClientVB.aspx.vb

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

#Region "Directives"

Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Configuration
Imports System.Data
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Text

#End Region

Partial Public Class ShowHideGridViewColumnsClientVB
    Inherits System.Web.UI.Page

#Region "Properties & Fields"

    ''' <summary> 
    ''' List of column names 
    ''' </summary> 
    Private columnNames As List(Of String) = New List(Of String)(New String() _
        {"Id", "Description", "Assigned To", "Status"})

#End Region

#Region "Page Load"

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        If Not IsPostBack Then
            _sampleData = Nothing

            ' Populate the GridView 
            Me.GridView1.DataSource = _sampleData
            Me.GridView1.DataBind()

            ' Setup the dropdown list to allow the user to show hidden columns 
            SetupShowHideColumns(Me.GridView1, Me.GridView1ShowHideColumns)
        End If
    End Sub

#End Region

#Region "GridView Events"

    Protected Sub GridView1_RowCreated(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
        Dim gridView As GridView = DirectCast(sender, GridView)
        Dim sb As New StringBuilder()

        ' For the header row add a link to each header 
        ' cell which can call the HideCol javascript method 
        If e.Row.RowType = DataControlRowType.Header Then
            ' Loop through each cell of the row 
            For columnIndex As Integer = 0 To e.Row.Cells.Count - 1
                ' Build the hide column link 
                sb.Remove(0, sb.Length)
后面还有 105 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。