gridview

W

William Niver

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
'Fill MyDataSet with your Data Here.
'///// Fake a DataSet ////////
Dim MyDataSet As New System.Data.DataSet
Dim MyDataTable As New System.Data.DataTable
Dim Column_Text As System.Data.DataColumn = New
System.Data.DataColumn("Column_Text", System.Type.GetType("System.String"))
Dim Column_Value As System.Data.DataColumn = New
System.Data.DataColumn("Column_Value", System.Type.GetType("System.String"))
MyDataTable.Columns.Add(Column_Text)
MyDataTable.Columns.Add(Column_Value)
MyDataSet.Tables.Add(MyDataTable)
For i = 0 To 10
Dim MyDataRow As System.Data.DataRow = MyDataTable.NewRow
MyDataRow("Column_Text") = CStr(i)
MyDataRow("Column_Value") = CStr(Now)
MyDataTable.Rows.Add(MyDataRow)
Next i
'/////////////////////////////
Dim MyGridView As New GridView
With MyGridView
.ID = "MyGridView"
With .Style
'Add any style properties you would like here.
.Add("border", "1px solid black")
End With
'Set any other Properties of your GridView that you would like
to set Here.
'Set your DataSource and Bind Data Here.
.DataSource = MyDataSet
.DataBind()
End With
'Add your GridView to another Controls' Control Collection.
Me.Page.Form.Controls.Add(MyGridView)
End Sub

Hope that helps!

William
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top