Advertisement
Advertisement
| 06.05.2008 at 08:41PM PDT, ID: 23462633 |
|
[x]
Attachment Details
|
||
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: |
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim pdb As cPlansDatabase = Session("Database")
Me.Label3.Text = Trim(Str(pdb.PlansTable.RowCount))
GridView9.AllowSorting = True
FillGridTable(pdb.PlansTable, GridView9, New String() {"Plan Number", "Project Number"}, New String() {"Plan #", "Project #"})
End Sub
Private Sub FillGridTable(ByVal mt As cMyDataTable, ByVal gv As GridView, ByVal fields() As String, Optional ByVal colnames() As String = Nothing)
Dim dt As New Data.DataTable
If Not colnames Is Nothing Then
For Each s As String In colnames
dt.Columns.Add(s)
Next
Else
For Each s As String In fields
dt.Columns.Add(s)
Next
End If
Dim dr As Data.DataRow
Dim o(fields.Length - 1) As Object
Dim i As Integer
For n As Integer = 0 To mt.RowCount - 1
dr = mt.Table.Rows(n)
i = 0
For m As Integer = 0 To fields.Length - 1
o(i) = dr.Item(fields(m))
i += 1
Next
dt.Rows.Add(o)
Next
gv.DataSource = dt
gv.DataBind()
End Sub
|