Dim objDataTable As New System.Data.DataTable
'Create three columns with string as their type
objDataTable.Columns.Add("Column 1", String.Empty.GetType())
objDataTable.Columns.Add("Column 2", String.Empty.GetType())
objDataTable.Columns.Add("Column 3", String.Empty.GetType())
'Adding some data in the rows of this DataTable
objDataTable.Rows.Add(New String() {"Row1 - Column1", "Row1 - Column2", "Row1 - Column3"})
objDataTable.Rows.Add(New String() {"Row2 - Column1", "Row2 - Column2", "Row2 - Column3"})
objDataTable.Rows.Add(New String() {"Row3 - Column1", "Row3 - Column2", "Row3 - Column3"})
Return objDataTable
End Function
Public Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim objDT As System.Data.DataTable = Me.GetCustomMadeDataTable()
Me.dgOne.DataSource = objDT
Me.dgOne.DataBind()
End Sub
10 December, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment