1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim dtUser As DataTable = New DataManager("CS").ExecuterRequeteSimple("EXEC dbo.SPEC_ListeRegie")
gvTest.Columns.Clear()
'For i As Int16 = 0 To dtUser.Columns.Count - 1
' Dim bf As New BoundField
' bf.DataField = dtUser.Columns(i).ColumnName
' bf.HeaderText = dtUser.Columns(i).ColumnName
' bf.SortExpression = dtUser.Columns(i).ColumnName
' gvTest.Columns.Add(bf)
'Next
Dim col1, col2, col3 As New BoundField
col1.DataField = "Nom"
col2.DataField = "Type"
col3.DataField = "Date Creation"
col1.HeaderText = "col1"
col2.HeaderText = "col2"
col3.HeaderText = "col3"
col1.SortExpression = "Nom"
col2.SortExpression = "Type"
col3.SortExpression = "Date Creation"
Dim bfUpd As New ButtonField
With bfUpd
.Text = "Modifier"
.ButtonType = ButtonType.Button
.CommandName = "Modif"
End With
Dim bfDel As New ButtonField
With bfDel
.Text = "Supprimer"
.ButtonType = ButtonType.Button
.CommandName = "Suppr"
End With
With gvTest
.AllowSorting = True
.AllowPaging = True
.PageSize = 20
.AutoGenerateColumns = False
.Columns.Add(col1)
.Columns.Add(col2)
.Columns.Add(col3)
.Columns.Add(bfUpd)
.Columns.Add(bfDel)
.DataSource = dtUser
.DataBind()
End With
End Sub |
Partager