gridview

  • Thread starter Thread starter Seema
  • Start date Start date
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
 
Back
Top