I'm teaching myself the basics of .NET (VB.NET) at the moment and have encountered something that doesn't make sense and am hoping someone can point out what I'm clearly not seeing. I've created a datagrid and bound some data to it, but I cannot see the datagrid when I attempt to open the page. I've attached my code below. Can someone point out what I may be missing? Thanks.
------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
Code:
Public Class TestConnection
Inherits System.Web.UI.Page
Protected WithEvents lblTest As System.Web.UI.WebControls.Label
Protected WithEvents lblMe As System.Web.UI.WebControls.Label
Protected WithEvents myDA As System.Data.SqlClient.SqlDataAdapter
Protected WithEvents myDS As System.Data.DataSet
Protected WithEvents myDT As System.Data.DataTable
Protected WithEvents myDG As System.Web.UI.WebControls.DataGrid
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
' Dim strConn As String
Dim myCN As New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
myCN.Open()
Dim myDA As New SqlDataAdapter("SELECT sugstn_id, sugstn_txt, lst_mod_id, lst_mod_dt, apprv_flg FROM T_SUGSTN", myCN)
Dim myDS As New DataSet
myDA.Fill(myDS)
Dim myDT As DataTable
myDT = myDS.Tables(0)
Dim myDG As DataGrid = New DataGrid
myDG.DataSource = myDT
myDG.DataBind()
End Sub
------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill